Does MOXy support non-line @XmlID in version 2.6.0?

According to https://gist.github.com/VineetReynolds/5108580 , the JAXB Spec requires that the element annotated with @XmlID be String . MOXy was not executed in versions 2.5.x.
However, with version 2.6.0 it is no longer supported.

 [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 the desired behavior or unwanted regression?

What is the correct way to avoid such an error when porting with MOXy 2.5.x?
Use @XmlJavaTypeAdapter as described in this post Marshaling a long primitive type using JAXB , which also affects how the object itself (and its identifier) ​​is serialized to JSON (for example, an id field of type Long becomes a json string?

+6
source share
1 answer

Yes, it is still supported. In version 2.6.0, it is not supported by default, but must be enabled using the @XmlIDExtension annotation.

https://eclipse.org/eclipselink/releases/2.6.php

Just annotate this field with @XmlIDExtension . You can also specify the system property org.eclipse.persistence.moxy.annotation.xml-id-extension to override the default behavior globally.

+6
source

Source: https://habr.com/ru/post/984956/


All Articles