I wanted to know why do we need to specify the Annotation @XmlAccessorType when working with JAXB .
When i googled for this i found out this description from a web
JAXB's @XmlAccessorType
annotation is only used by JAXB (JSR-222) implementations for determining how to marshal a file to/from XML:
Normally the main decision to be made is between FIELD
& PROPERTY
/PUBLIC
. FIELD
is particularly useful when you have logic in your get/set methods that you do not want triggered during marshalling/unmarshalling. To see one way this choice affects the mapping metadata see:
NONE
is a useful choice when you have many unmapped properties and you want to tell your JAXB implementation to only map the fields/properties you have annotated. This can be alot easier than adding a lot of @XmlTransient
annotations into your model.
Fore More Information