mavenjpaintellij-idea

"package javax.persistence does not exist" using spring-data-jpa and IntelliJ


I'm starting a project using spring-data-jpa in IntelliJ but I am failing to load javax.persistence ("package javax.persistence does not exist").

I have been at it for four hours with what seems be be a very simple problem. I used the standard IntelliJ UI to create the project and selected the spring framework and spring-data-jpa options.

My only code is:

import javax.persistence.entity;

@entity
public class customer {

}

The project fails to build and the tool tips in the IDE say "Can not resolve symbol persistence" What am I missing?

My directory structure can be found below: enter image description here


Solution

  • All I needed to do was add the hibernate libs from maven through the project structure dialog (hibernate-entitymanager)