tags:

views:

225

answers:

2

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>
+1  A: 

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

Tadeusz Kopec
A: 

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

For more information see:

Blaise Doughan