How to create a jpa project in eclipse?

The following two tabs change content below.
Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

Latest posts by Prasad Kharkar (see all)

Hello, In this article we will learn how to create a jpa project in eclipse.

What do we need?

For setting up JPA project, we are using

  • mysql database 5.x
  • eclipse kepler
  • JPA 2.x
  • Some database created in your mysql database. I have created a database named thejavageek.

That’s all we need to create a jpa project in eclipse.

Open your eclipse workspace and then File > New > JPA Project . You will see a dialogue as follows.

JPAProjectWindow

Name your project as JPAExamples and select appropriate JPA version. I’ve selected JPA 2.1. Keep clicking next till you see this dialogue.

JPAProjectFacet

This dialogue provides information about available jpa libraries in workspace. If they are not available there, you can download corresponding libraries from the option provided.

I’ve selected eclipseLink version 2.5 here. Now create a database connection using Add Connection link.

New Connection Profile

I’ve selected MySQL here as its the database server I’m using. Click next till you get this dialogue.

New Connection Profile1

Fill in your database details here, For me database url : jdbc:mysql://localhost:3306/thejavageek .

That’t it. You can test the connection now. It will succeed and click Finish on the dialogue box.

You have learned how to create a jpa project in eclipse.  You can see a file called  persistence.xml  created in your project.

 

References for further study :

Share Button

Prasad Kharkar

Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

2 thoughts on “How to create a jpa project in eclipse?

Leave a Reply

Your email address will not be published. Required fields are marked *