[英]How to map the latest child of a collection with JPA and Hibernate
[英]Hibernate: how to map collection of Double?
如何映射Double值列表
class Person {
@Id
private String key;
@OneToMany
@Column(name="values")
private List<Double> values;
我得到這個錯誤
Use of @OneToMany or @ManyToMany targeting an unmapped class: Person.values[java.lang.Double]
嘗試像這樣使用注釋@CollectionOfElements
:
@CollectionOfElements
@Column(name="values")
private List<Double> values;
如果您使用的是3.4,則可以使用。
而且,如果您使用的是Hibernate Annotations 3.5+,則更喜歡使用@ElementCollection
注解的JPA 2.0注解:
@ElementCollection
@Column(name="values")
private List<Double> values;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.