VOOZH about

URL: https://www.geeksforgeeks.org/advance-java/how-to-create-a-jpa-project-using-intellij-idea-ultimate/

⇱ How to Create a JPA Project using IntelliJ IDEA Ultimate? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Create a JPA Project using IntelliJ IDEA Ultimate?

Last Updated : 23 Jul, 2025

The Java Persistence API (JPA) is a Java specification for accessing, persisting, and maintaining data between Java objects and a relational database. IntelliJ IDEA Ultimate provides robust support for the JPA frameworks making it the ideal environment for developing database-driven applications using Java.

Prerequisites:

  • IntelliJ IDEA Ultimate should be installed in your local system.
  • JDK should be installed in your local system.
  • MySQL database for the relational database required for the application during the development.
  • Maven for the building dependency management of the application.

Implementation of Creating JPA project using IntelliJ IDEA Ultimate

Below are the steps to create a JPA Project using IntelliJ IDEA Ultimate.

Step 1: Open the IntelliJ IDEA ultimate and create the new project of the JPA application.

  • Select File > New Project > Jakarta EE > simple-jpa-application.
  • Choose Maven for the left panel and ensure the java is selected then enter the Project SDK (JDK 11) .
  • Click on Next, name of the project and choose the suitable location for it.
👁 JPA Project Creation


Step 2: Add the Dependencies

Now, we will add the Persistence (JPA) and Hibernate of the JPA application and click on the create button.

👁 Add dependencies


After the project creation done, then the folder structure will be like below.

👁 Folder Structure


Step 3: Configure the JPA

Open the persistence.xml file and write the below code then configure the mysql of the JPA application.


Step 4: Create the Entity Classes

We will now create a new Java class inside src/main/java directory location of the application.

User.java:


Step 5: Perform the Operations

Create the MainApplication class for perform operations in src/main/java/MainApplication directory location of the application.


pom.xml:


Step 6. Running the Application

Once all the steps done, run the MainApplication class. If everything is configured correctly, then the application will start and connect to the database and persist an entity.

👁 Application Runs


After running the application, the user data will be saved into the database.

👁 Database user data saved


This article provides the guide the fundamental setup for the JPA project in the IntelliJ IDEA Ultimate and it enables us to start building more complex Java database applications.

Comment
Article Tags:
Article Tags:

Explore