How does MOXy's xml-transient declaration work?

You can specify use the following mapping file to make the "phoneNumbers" property on Customer transient.

Up vote 2 down vote favorite share g+ share fb share tw.

I have a set of a beans in a separate project that I'm unable to alter. These beans have both JPA and JAXB annotations, and are being used in a RESTful implementation. Most of my relationships are lazy-loaded, and I was hoping to achieve some more granular control over which elements are actually marshalled for transport.

I've got the modified MOXy Customer. Java class below. @javax.xml.bind.annotation.

XmlType @javax.xml.bind.annotation. XmlAccessorType(value=javax.xml.bind.annotation.XmlAccessType. PROPERTY) public class Customer { private String name; private Address address; private List phoneNumbers; // getters and setters } I was hoping I'd be able to use the MOXy eclipselink-oxm mapping to control what gets marshalled, but it isn't behaving as I'd expect.

Using JAXB annotations, you declare an element (field or property) to be transient, but the eclipselink-oxm. Xml only allows transient declarations on types. However, when I declare a type transient like so, I get the following exceptions: Exception: Exception EclipseLink-110 (Eclipse Persistence Services - 2.1.0.

V20100614-r7608): org.eclipse.persistence.exceptions. DescriptorException Exception Description: Descriptor is missing for class example.gettingstarted.PhoneNumber. Mapping: org.eclipse.persistence.oxm.mappings.

XMLCompositeCollectionMappingphoneNumbers Descriptor: XMLDescriptor(example.gettingstarted. Customer --> DatabaseTable(customer)) If I remove the xml-transient attribute, or set it to false, the Customer is transformed into XML as expected. Is there any way I can suppress the marshalling of phone numbers without modifying the Customer bean?

Java jaxb eclipselink moxy link|improve this question edited Mar 28 '11 at 13:53Blaise Doughan23k51533 asked Mar 28 '11 at 13:27Filip74539 93% accept rate.

You can specify use the following mapping file to make the "phoneNumbers" property on Customer transient: For more information on MOXy's XML mapping file see: bdoughan.blogspot.com/2010/12/extending-....

Perfect. This worked. I should have read the .

Xsd more carefully. – Filip Mar 28 '11 at 14:02.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions