【问题标题】:Is it possible to persist a map containing another collection是否可以保留包含另一个集合的地图
【发布时间】:2012-02-18 11:21:00
【问题描述】:

我想知道是否可以在 jpa 托管实体中具有以下数据结构。

@Entity
public MyEntity {

    @ElementCollection
    public Map<String, Set<MyEntityTwo>> map;
}

我做了一些基本测试,但出现以下错误:

JPA error
A JPA error occurred (Unable to build EntityManagerFactory): Could not determine type for: java.util.Set, at table: ModelOne_map, for columns: [org.hibernate.mapping.Column(map)]

play.exceptions.JPAException: Unable to build EntityManagerFactory

【问题讨论】:

    标签: java hibernate jpa collections


    【解决方案1】:

    找到了这个link,它指出标准 JPA 不可能,首选方法是创建一个包装器对象。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-22
      • 2015-10-09
      • 1970-01-01
      • 1970-01-01
      • 2017-08-30
      • 2015-07-14
      • 2014-12-18
      • 2012-03-31
      相关资源
      最近更新 更多