Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven / eclipse JPA project and Entity generation?

Im a bit confused about this :

  1. I've setuped a simple maven-archetype-webapp
  2. So far i've been creating entities from a plain POJO, adding annotations as needed
  3. But lately i think that there could be ways to ease this entity creations, so i googled
  4. And found out about eclipse that could help me generate the JPA entities ..
  5. I tried right clicking on my package that contains the entities, and new -> JPA -> Entity, only to find out that i can only make use of this in a JPA project.
  6. In one hand, i have a maven project (which is not a JPA project created by eclipse), and in the other hand, i'd like to give eclipse JPA a try.

And one more thing, i have something in mind that we could design with a GUI tool, creating entities, defining the relations, defining configurations like the id generation sequence, multiple unique columns, compound key, etc and have the JPA entities generated for you.

Does this kind of tool exist ? Perhaps as an eclipse plugin or something else ?

like image 700
Albert Gan Avatar asked Jan 13 '11 10:01

Albert Gan


1 Answers

JPA tooling can be added to an existing Eclipse project in a couple of ways, depending on the type of project you are starting with. If you have a Java project, you can right-click on it and use the "Configure" -> "Convert to JPA project..." menu item to add JPA project capabilities to an existing Java project. If you have a Web project or other WTP based project (known as "faceted" projects), you can simply add the JPA facet to the project in the project properties on the "Facets" node. If you are starting from scratch you can create a JPA project, which is basically just a Java project with JPA tooling added in.

I'm not sure if you are using m2e, but this is the Eclipse Maven integration tooling. There are some known issues using Maven with the JPA tooling in Eclipse, but there are workarounds that may work for you.

As for graphical diagramming tools for developing entities, this is coming to the Eclipse Dali Java Persistence Tools project for the next release - 3.0 (Indigo). You can try this functionality out now by downloading the JPA Diagram Editor. Check out the youtube video (search JPA Diagram Editor) for a quick demo of the functionality.

Sorry for the lack of links, but I can only post 1 per reply as a new user.

like image 92
Neil H Avatar answered Nov 17 '22 00:11

Neil H