Reputation: 704
I'm working on to convert Hibernate objects to XML using JAXB. In our classes, we've around 50 fields from which I would need only 10 of them.
Basically, I'd defined XmlType#propOrder with 2 properties. JAXB complained that some public getters are not part of proporder. I see that if I don't mark a property with either of XmlTransient/XmlElement, JAXB complains about it. Is there any way to skip writing 'XmlTransient' on every field?
Upvotes: 3
Views: 3218
Reputation: 148987
You can use @XmlAccessorType(XmlAccessType.NONE)
so that only the annotated fields/properties are marshalled to XML. JAXB does not require any annotations. Annotations are only required to override the default behaviour. What exceptions are you seeing?
For More Information
Upvotes: 7