开发者

HyperJAXB and IDREFs

开发者 https://www.devze.com 2023-01-02 10:23 出处:网络
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 gene

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 开发者_JAVA技巧allows generating classes so that they implement a particular interface? Could that lead anywhere?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号