Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

Best pratice to persist JAXB generated elements

$
0
0
From a given schema, I generated a bunch of classes using Apache CXF wsdl2java tool. Now I'd like to persist them using Spring Data JPA. I guess I have two options:

1. Annotate the generated JAXB classes with JPA notations.
2. Create a separate JPA entities and write some mapping logic to convert JAXB elements to JPA entities.

Neither option is ideal:

With option 1, every time the schema is changed, I will have to re-annotate the generated classes with JPA notations

Option 2 require lots of labor to write mapping/transform logic, not to mention duplicated domains.

I found HyperJaxb3 which can generate both JPA and JAXB notations, but not sure if this is the right path.

Any ideas or suggestions on the best way to combine JAXB and JPA?

Thanks,
Khoa

Viewing all articles
Browse latest Browse all 297

Trending Articles