I have a project using hibernate for its domain classes, and I'm now implementing marshalling for these (both JSON and XML). To avoid cyclic references, I have an XmlAdapter that downcasts the object to its superclass. This works fine for JAXB, and solves my problem with XML.
When I try to do the same in Jackson (with the JAXB annotation introspector) it does not see the actual Set<T>, but instead it sees the PersistenceSet from hibernate.
Right now I'm using a introspector pair where Jackson is the primary, so if I add @JsonProperty and @JsonSerialize (with a serializer that write out my downcasted version) it works fine. The serializer gets the correct object.
Is this the intended behavior ? It feels like a bug.