我将@ElementCollection用于自定义对象列表
@ElementCollection
@CollectionTable(name = "choice", joinColumns = @JoinColumn(name = "itemId"))
@OrderColumn(name = "index")
private List<Choice> choices = new ArrayList<Choice>();我创建了一个如下的Choice类
//@Embeddable
@Table(name = "choice")
@Cacheable(false)
@Audited
public class Choice implements Serializable{如果我使用@Embeddable注解,我会得到org.hibernate.MappingException: Type not supported for auditing: org.hibernate.type.ComponentType
我是JPA的新手。我是不是漏掉了什么?
发布于 2012-02-18 05:10:20
如果要使用@Embeddable,引用@Embeddable类的字段需要有@Embedded注释。然后,@Embedded类中的字段需要有适当的JPA注释,以便JPA知道如何处理它们。为了完全理解@Embbedable的作用,您可能想要阅读this。
https://stackoverflow.com/questions/8951111
复制相似问题