Spring Data JPA intelligence not working in Intellij
I solved this problem by adding JavaEE Persistence
framework support. Just right click on the project, select Add Framework Support
and then scroll down to find the JavaEE Persistence
, then enable the checkbox and hit OK:
Adding JavaEE Persistence Facet
It will add a persistence.xml
file, you can delete it. Finally your auto completions will be back:
Update You can also enable JPA
facet in the Project Structure
. First, press Ctrl Alt Shift S
or go to Files > Project Structure
. Hit the Add
button and in the menu, then select JPA
:
And finally hit OK
.
OPK
Updated on June 04, 2022Comments
-
OPK almost 2 years
I have set up a spring boot project with Spring Data JPA, but I am not seeing the intelligence for Spring data jpa.
The screen shot shows the issue, my Restaurant entity has a variable call
restaurantAddress
, I am trying to let intelliJ help me finish the coding but no intelligence shows up.My project set up is as follows:
Application class:
@SpringBootApplication @ComponentScan(basePackages = {"com.mycompany"}) public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId> <artifactId>food</artifactId> <version>1.0-SNAPSHOT</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.7.RELEASE</version> </parent> <dependencies> <!-- Dependencies for RESTful Web Services --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- Dependencies for JPA Data Persistence --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <!--JDBC--> <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> <version>9.1-901-1.jdbc4</version> </dependency> </dependencies> <build> <finalName>food</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
I have Spring Data plugin installed on my IntelliJ 15, prject settings:
-
gtiwari333 about 8 yearsI do not have the option "JavaEE Persistence" listed on the "Add Framework Support Dialog" . I added the dependency org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final to POM but it is still not showing up.. Any suggestions?
-
gtiwari333 about 8 yearsI've already added JPA facet. But the intelligence is still not working.
-
Ali Dehghani about 8 yearsWhich version of intellij? Did you check your plugins?
-
gtiwari333 about 8 yearsIntellij version is : 15.0.3
-
gtiwari333 about 8 yearsLet us continue this discussion in chat.
-
Ali Dehghani almost 8 years@David Which version of IntelliJ?
-
Ali Dehghani almost 8 years2016.1.2 is the latest one..Is your project is a Spring Boot project?Some versions of IntelliJ does not support Spring Boot very well.
-
Sieva Kimajeŭ over 7 yearsIf you already has JPA framework support but no completion, you should remove it and add again. It will(?) generate new configs. Worked for me.
-
Ali Dehghani over 7 years@anibyl Adding a totally useless
persistence.xml
sometimes will do the trick, I guess -
akuma8 almost 6 yearsIntellij 2018.1.5 same issue, the @UsievaładKimajeŭ suggestion works for me. i.e remove Spring Data plugin, restart then enable it.
-
Olkunmustafa over 5 yearsGreat answer. Thank you!
-
Marian Klühspies almost 5 yearsNot working for me. Removed the config multiple times. Do I have to set it to hibernate or no provider?
-
Cihangir over 3 yearsUsievaład Kimajeŭ' s suggestion worked for me. Remove and add Spring Data again.
-
Seeschon over 2 yearsJust add once & restart your device, it works for me