问题
I have eventually managed to fiddle HyperJAXB so that when XSD has complexType A and this has an IDREF to complexType B, then HyperJAXB will generate @OneToOne JPA annotations between the the two generated entities.
However now I'm facing another problem: the XSD has complex type X that can IDREF to either complex type Y or complex type Z. In the end, I need instance of complex type X contain reference to either instance of class Y or class Z.
Do you have any wild ideas how can this be done without manual alterations to the generated classes? And at the same time to make sure these entities are marshalled to a correct XML?
How about using the JAXB plugin that allows generating classes so that they implement a particular interface? Could that lead anywhere?
回答1:
HJ2 supported the "idsSymbolSpace" feature of JAXB1. In JAXB2 it's done in a different way (I think with jaxb:class, but I'm not sure). HJ3 does not support it yet, here's the issue:
http://jira.highsource.org/browse/HJIII-53
来源:https://stackoverflow.com/questions/2993651/hyperjaxb-and-idrefs