Henrik Bierbum Bacher
Henrik Bierbum Bacher

Reputation: 80

Serialization of Entity classes using Xstream

I'm using Xstream to serialize a EJB entity class to be transferred by a web service, but it also writes the database specific information in this case the following code. Is it possible to omit this information?

                <oracle.toplink.essentials.internal.helper.DatabaseField>
                  <scale>0</scale>
                  <length>255</length>
                  <precision>0</precision>
                  <isUnique>false</isUnique>
                  <isNullable>true</isNullable>
                  <isUpdatable>true</isUpdatable>
                  <isInsertable>true</isInsertable>
                  <columnDefinition></columnDefinition>
                  <name>ZIPCODEID</name>
                  <table>
                    <name>ZIPCODE</name>
                    <tableQualifier></tableQualifier>
                    <qualifiedName>ZIPCODE</qualifiedName>
                    <uniqueConstraints/>
                  </table>
                  <sqlType>4</sqlType>
                  <index>0</index>
                </oracle.toplink.essentials.internal.helper.DatabaseField>

Upvotes: 0

Views: 1224

Answers (3)

Tadeusz Kopec for Ukraine
Tadeusz Kopec for Ukraine

Reputation: 12413

From FAQ:
How do I specify that a field should not be serialized?
Make it transient, specify it with XStream.omitField() or annotate it with @XStreamOmitField

Upvotes: 1

Alex Vaz
Alex Vaz

Reputation: 516

If you use openJPA you can detach the object to get the naked entity.

Check ->

http://openjpa.apache.org/builds/1.0.0/apache-openjpa-1.0.0/docs/manual/ref_guide_remote.html

Hope it helps...

Upvotes: 0

bdoughan
bdoughan

Reputation: 149017

EclipseLink (open sourced from TopLink) JAXB has extensions specifically for mapping JPA entities to XML:

For more information see:

Upvotes: 0

Related Questions