How to export EclipseLink objects to XML
is there an easy approach to store my model, which I use with EclipseLink, in XML files?
I want to implement an export functionality in my progr开发者_如何学运维am and I was wondering if this can be done with eclipselink or with any other framework.
Thanks
Take a look at the EclipseLink MOXy component ( https://wiki.eclipse.org/EclipseLink/FAQ/MOXy ). This will easily allow you to map your existing POJO's to XML.
Depending on the complexity of your data model, using JAXB should be a relatively easy way to marshal (export) your objects to XML. You will have to annotate your entities with @XmlRootElement
or @XmlType
and your fields with @XmlElement
or @XmlAttribute
.
精彩评论