Enable JPA Tools in Eclispe

Hello Guys..

Sometime we need to generate entities from the database table or vice versa. Off course we can do it manually, but that is huge time consuming process.

In those situations, JPA Tools comes into action and plays a handy role creating the entities from already existing the database. How can we do that in our project.

  1. Convert the project into JPA Project. (Right click on project -> configurations -> convert to JPA Project)
  2. Once converted, again right click on the same project and you will see a “JPA TOOLS” in the context menu options.
  3. There you will see “Generate tables from entities” and few more options.

Now if you are using STS, you will wonder why you can not convert the given project to JPA project. In fact the option in configuration is missing itself. Then how can we convert the project??

No worries, it matter of installing few plugins that will make this feature available in your favourite IDE. Please follow them below.

  •  Move to Help (?) -> Install new software .
  •  Select your current version of eclipse. While writing this article, I am using Neon. It will fetch all the available software which you can install and improve your IDE.
    (But make sure, you do not install those which you don’t need, otherwise your system will crawl.. 😛 )
  • Move towards last and there you will find “Web, XML, Java EE and OSGi Enterprise Development
  • Expand that and select all the children having JPA as its title.
  • Install and then restart the IDE.

We are done. Now convert the project to JPA and use the JPA Tool to generate entities and vice versa.

This slideshow requires JavaScript.

I hope this will help.

Happy Coding
Sovan 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s