bimargulies wrote:
>
> I think that if you read any of the stock tutorials on JAXB, you'll
> see that this is made pretty clear. They explain that JAXB infers
> elements from fields or from get/setters, as controlled by the
> annotations on the class. By default, those annotations do not examine
> anything private.
>
> Look at the J2SE 6.0 javadoc for XmlAccessorType to see what I'm talking
> about.
>
Thank you for this pointer. I agree with you after reading through the
documentation and trying things out. Just want to summarize this, because it
did not seem to be obvious or intuitive to me.
Actually the JAXB guide on how to map cyclic references [1] uses field-level
annotation. I acknowledge that the field in that example (Department on
class Employee) is not private, but I don't see any indication of
restrictions on the visibility scope level. I have tried annotating the
field in the test case attached to CXF-2041 with XmlTransient, and it does
not work, even if the field is not private (similar to the example in the
JAXB guide, but not working).
It does actually work, if the class or package is annotated with the
appropriate XmlAccessorType:
## start
@XmlAccessorType(XmlAccessType.FIELD) // added this annotation
public class Child extends EntityObject {
@XmlTransient // now this annotation is not ignored anymore
Parent parent;
...
}
## end
I don't think there is any problem in the RI. I just needed to annotate the
classes correctly.
Thank you for your efforts and explanations,
Kariem
[1] https://jaxb.dev.java.net/guide/Mapping_cyclic_references_to_XML.html
--
View this message in context:
http://www.nabble.com/CXF-doesn%27t-respect-annotations-tp19894613p22029423.html
Sent from the cxf-user mailing list archive at Nabble.com.