According to https://gist.github.com/VineetReynolds/5108580, JAXB Spec requires element annotated with @XmlID
to be a String
. This hasn't been enforced by MOXy in versions 2.5.x.
With version 2.6.0, however, it seems it's not supported anymore.
[Exception [EclipseLink-50016] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Property [id] has an XmlID annotation but its type is not String.]**strong text**
Is this a wanted behavior, or an unwanted regression?
What is the right way to avoid such error when migrating from MOXy 2.5.x?
Is it to use @XmlJavaTypeAdapter
as described in this post Marshaling a long primitive type using JAXB, which also affects the way how the object itself (and its ID) gets serialized to JSON (e.g., id field of type Long
becomes a json string?