views:

75

answers:

2

Hi,

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 program and I was wondering if this can be done with eclipselink or with any other framework.

Thanks

+4  A: 

Take a look at the EclipseLink MOXy component ( http://www.eclipse.org/eclipselink/moxy.php ). This will easily allow you to map your existing POJO's to XML.

Gordon Yorke
+3  A: 

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.

Bozho
The EclipseLink MOXy component is a JAXB implementation. It also has extensions to handle JPA entities (see http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA )
Blaise Doughan