How to enable HQL / JPQL autocompletion in IntelliJ 12

I have a problem in IntelliJ 12 to enable JPQL / HQL auto completion support. Whenever I edit a request, IDEA does not offer me anything on Ctrl-Space.

I have the following plugins:

  • Database
  • Hibernate
  • Conservation Structures.
  • Java EE
  • SQL

Suppose we have this entity.

@Entity public class SubKonto extends PersistentEntity implements Serializable { @OneToOne private Hierarchieknoten hierarchieknoten; @ManyToOne private SchnittstellenKonfiguration schnittstellenKonfiguration; @Column private String kontoNummer; } 

If I write a JP request myself, I saw that IntelliJ supports autocomplete.

 "from Sub 

with ctrl-space ends before

 "from SubKonto 

Then from

 "from SubKonto sk where sk.k 

with ctrl-space ends before

 "from SubKonto sk where sk.kontoNummer 

Can someone tell me how to turn it on ?,

+4
source share
1 answer

I don’t think your plugins are a problem. There are two things you should check:

  • Make sure you have the JPA facet installed. You can do this in the project structure menu (see screenshot below).

enter image description here

  • Configure the persistence block by clicking View β†’ Windows Tools β†’ Persistence. Then you will see the panel shown in the screenshot below in the lower left corner. Right-click on the top of the node here (in my example, it will be a "Joint Platform", and then you can add a new constant.

Note. The recommended, but optional step is to configure the data source, as well as link it to your persistence device. You can do this in the database panel located to the right of the screenshot. After you have added the data source, you can right-click your persistence block and select "Assign data sources ..."

enter image description here

Your autocomplete should be up and running (this works for me :)).

+6
source

Source: https://habr.com/ru/post/1483594/


All Articles