开发者

hibernate::map mapping

I have some class C that contains Map<A, Set<B>>, where A and B has long id and mapped in tables a and b. I want do some mapping of C into table with 2 attributes a_id and b_id. How can开发者_高级运维 I do it?


I am not positive I understood you question correctly, but if I did you could try the following.

Create a new table that has 3 columns, a_id, b_id, and c_id where only c_id cannot be null. Every entry in that table will represent a mapping from c -> {a || b}. In hibernate you will have a ManyToMany set or list of a's and b's in the c class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜