我有同样的问题,这里在 hibernate 3 中得到了回答。但是,我不能将此应用于休眠 4,因为没有 @CollectionOfElements 注释。有人可以提供可以使用hibernate 4执行的解决方案吗?
编辑:将@CollectionOfElements 更改为@ElementCollection 对我有用。我现在应该用@JoinTable 做什么,因为那里没有表格字段。
我有同样的问题,这里在 hibernate 3 中得到了回答。但是,我不能将此应用于休眠 4,因为没有 @CollectionOfElements 注释。有人可以提供可以使用hibernate 4执行的解决方案吗?
编辑:将@CollectionOfElements 更改为@ElementCollection 对我有用。我现在应该用@JoinTable 做什么,因为那里没有表格字段。
Hibernate 4 仅支持标准 JPA 注释,即@ElementCollection。
请注意,即使Hibernate 3 也建议使用此标准注释:
已弃用。使用@ElementCollection