【问题标题】:Hibernate 4 - Can add extra field(s) to @ManyToMany Hibernate extra table?Hibernate 4 - 可以向@ManyToMany Hibernate 额外表添加额外字段吗?
【发布时间】:2012-12-07 20:42:52
【问题描述】:

我有同样的问题,在 hibernate 3 here 中得到了回答。但是,我不能将此应用于休眠 4,因为没有 @CollectionOfElements 注释。有人可以提供可以使用hibernate 4执行的解决方案吗?

编辑:将 @CollectionOfElements 更改为 @ElementCollection 对我有用。我现在应该用@JoinTable 做什么,因为那里没有表格字段。

【问题讨论】:

  • @ElementCollection 呢???
  • 忽略JoinTable,不需要它。您可能需要@OrderColumn,如有必要

标签: java hibernate annotations


【解决方案1】:

Hibernate 4 只支持标准的 JPA 注解,即@ElementCollection

注意即使Hibernate 3 recommends using this standard annotation:

已弃用。使用@ElementCollection

【讨论】:

    猜你喜欢
    • 2010-11-12
    • 1970-01-01
    • 1970-01-01
    • 2012-02-04
    • 1970-01-01
    • 2021-07-05
    • 2012-05-19
    • 2015-08-26
    • 2018-10-10
    相关资源
    最近更新 更多