HyperJAXB and IDREFs

ⅰ亾dé卋堺 提交于 2019-12-11 04:55: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 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!