Title says it all.
I would like to know what is the principial difference between putting JAXB annotation (like @XmlElement
) on field / getter / setter. It
By default JAXB impls will treat properties (get/set pairs), public fields (instance variables), and annotated non-public fields as mapped. If you just annotate a field you will get a duplicate mapped property exception.
If you want to annotate the field you should specify @XmlAccessorType(XmlAccessType.FIELD)
on the class.
For More Information