I use Jackson to create JSON for polymorfic objects using an annotation in the ancestor class:

// Include Java class name ("com.myempl.ImplClass") as JSON property "class"@JsonTypeInfo(use=Id.CLASS, include=As.PROPERTY, property="class")Using this annotation, the descendant classes will have the 'class' property with the classname of the object. This classname will be used when Jackson converts back JSON object to the correct descendant.
When using JAXB with

@XmlSeeAlso({Class1, Class2, ... ClassN })annotation, you have to specify all the subclasses of the element if you want correct unmarshalling, or you should add all element to the JAXBContext, when creating a new JAXBContext instance.
Is there a way to specify the object classname to JAXB just like the with Jackson?If there's no way, why?

Check Solution