我在Hibernate 中映射列表时似乎遇到了问题。在我们的项目中有一个类 Profile
, 它包含一个 List<String>
.
是List<String>
Hibernate 可以使用注释,使用 Java Persistence 1.0 进行映射(否 ElementCollection
!)? (注释如 @Entity
)
我知道 Java Persistence 2.0 由 ElementCollection
组成,但在我们的项目中,我们只有 Java Persistence 1.0。
最佳答案
在 JPA 1 中没有类似的东西。您必须回退到 Hibernate 特定注释并使用 CollectionOfElements相反:
@org.hibernate.annotations.CollectionOfElements
List<String> myElements;
关于java - Hibernate List<String> Java 持久性 1.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11626367/