XSD Schema - JAXB marshaling - Datastore(JPA/JDO) Roundtrip

孤者浪人 提交于 2019-12-03 20:16:14

问题


I'm trying to find a way to accomplish a xsd schema to datastore roundtrip, with minimum effort.

I used jaxb to build my object model from schemas, now I would like to store these objects based on JPA (or JDO or something else?). Is it possible, to auto enhance the objects with the missing annotations based on the JAXB Annotations? Is it desirable?

Thanks


回答1:


You have several options for this use case.

Option #1 - Hyperjaxb3

I have not used this myself, but Hyperjaxb3 is supposed to generate both JAXB and JPA annotations on the model:

  • http://confluence.highsource.org/display/HJ3/Home

Option #2 - Use Dali to map your POJOs to Database (JPA)

The Eclipse Dali tool provides tooling to easily map your POJOs to a relational database using JPA:

  • http://www.eclipse.org/webtools/dali/

Option #3 - Use EclipseLink

EclipseLink provides both JPA and JAXB implementations. The JAXB implementation (MOXy) contains extensions specifically for handling JPA entities:

  • http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA



回答2:


Use DataNucleus and you can persist via JDO or JPA and internally it uses JAXB. http://www.datanucleus.org



来源:https://stackoverflow.com/questions/4086388/xsd-schema-jaxb-marshaling-datastorejpa-jdo-roundtrip

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!