问题描述
在本文中以及在这个问题中,解释了如何使用@Any注解。但是,我怎样才能获得每张DVD / VHS / BOOK的借阅?如何在DVD / VHS / BOOK上做映射定义?
In this article http://www.jroller.com/eyallupu/entry/hibernate_the_any_annotation and also in this question How to use Hibernate @Any-related annotations?, how @Any annotation can be used was explained. But how can I get borrows for each DVD/VHS/BOOK? How can I do mapping definition on DVD/VHS/BOOK?
推荐答案
我不认为 这是支持的,正如文件中提到的那样:
I don't think this is supported and, as mentioned in the documentation:
尽管我明白这个注解是为了将一个关联属性映射到没有共同祖先实体的不同类型的实体而引入的,但我认为最好引入一个基类键入其他实体将从双向关系继承。
While I understand that this annotation has been introduced to map an association property to different types of entities that don't have a common ancestor entity, I think it would be better to introduce a base type the other entities would inherit from for bidirectional relations.
- @Any bidirectional relationship fails
这篇关于我如何通过@Any注释的属性进行双向映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!