Overview of JPA support
For working with Java Persistence API (JPA), IntelliJ IDEA provides:
- The Java EE: EJB, JPA, Servlets plugin. This plugin is bundled with the IDE and enabled by default. See Making sure that the Java EE: EJB, JPA, Servlets plugin is enabled.
- An ability to turn on JPA support for a module. You can do that when creating a project or module, or for an existing project or module. See Enabling JPA Support.
- A JPA facet for managing JPA configuration (
persistence.xml) and object/relational mapping (
orm.xml) files. See Hibernate and JPA Facet Pages.
- The Persistence tool window that shows your JPA project items and lets you create new configuration files and persistent classes, navigate to related source code in the editor, open diagrams and consoles, and more. See Working with the Persistence Tool Window.
- An ability to generate managed entity classes and object/relational mappings for them by importing a database schema, an EJB deployment descriptor file
ejb-jar.xmlor a Hibernate object/relational mapping file
.hbm.xml. See Generating managed entity classes and O/R mappings.
- Entity-relationship (ER) diagrams.
The ER diagrams are accessed from the Persistence tool window (see Opening entity-relationship diagrams) and provide about the same set of functions as the tool window.
Those functions are accessed as context menu commands. The context menus are different for the entity classes and the main diagram area (which corresponds to a <persistence-unit>).
- A JPA console that lets you write and run JPQL queries, and analyze the query results. See Working with the JPA console.
- Code completion in Java code including JPA annotations and their attributes, and also in JPA configuration and O/R mapping XML files.
- JPA-specific code inspections.
- Navigation markers in the left margin of the editor e.g. for jumping from entity classes to corresponding fragments in mapping files.