Monday 15 March 2010

Auto-generate JPA XML mappings from clean Java classes / POJOs using library/tool -


I am currently working for a customer who developed many clean, non-annotated Java POJO domain models. Each domain model has approximately 15-50 classes. So far, these Java Pojo domain models are only used in Android apps. My clients are undertaking a new project, it is necessary to use these domain model server side, and it is necessary to save the examples of your classes in a SQL database.

We will use JPA for this. Since the jar needs to be reused in the current Android app, using JPA annotations is not an option. Therefore, I have to make JPA XML mapping for these 100+ sections.

I was wondering: Can JPA XML Mapping using some lib / tools generate XML mapping from clean Java classes / POJO? When I started looking up, I thought I was getting "Jahomodel 2 JPAP XML Mapping" tool very quickly, but so far, there was no luck, and I was only looking a while ago.

For me, it seems that a device that will be useful in many scenarios, so I can not believe that it is not in existence.

I know that equipment like HBM2 Java, I know that it is possible to make POOOS / ORM mapping from DDL and POJOS / DDL with an ONR Mapping. But I need Om mapping which has been given to POOs.

In addition to this, I know that JPA XML Mapping can automatically map very little and simple / original properties. I know that I will not have to map every single property, but still, if I do not find such a tool, then I have to face the repetitive work.

So, there is a "Javmoldel 2 JPA XML Mapping" tool?

Maybe stupid idea but how about the back / proxy about back generators. Files with JPA JPA @ Annotation Tag Big show stops may be that your app should use the JPAC customer type, which is not real. Just one suggestion does not kill the Messenger.

  @Entity @Table (name = "customer") public class increases the JPC customer customer {@Id @ generatedValue (strategy = GenerationType.INDNTITY) public long GetId () {return super. GetId (); } Public Zero Set ID (Long ID) {Super .setId (ID); } @column (name = "name") public string getName () {return super.getName (); } Public Zero Setname (strings) {super.setName (s); } // ElementClonen offers simple EkTam linking in OpenJPa. // Insert column.name = @ElementCollection (fetch = FetchType.LAZY) @CollectionTable (name = "cust_role", joinColumn = {@ JoinColumn (name = "cust_id")}) @ column in the hair table (name = "role ") Public listing & lt; String & gt; GetRoles () {return super.getRoles (); } Public Zero centrum (list & lt; string & gt; roles) {super.setRoles (roles); } ...}    

No comments:

Post a Comment