@ElementCollection :使用集合的拥有实体 table
@ElementCollection : Use the owning entity table of the collection
我有这个实体:
@Entity
@Table( name = "Group" )
public class Group implements Serializable {
@Id
private Long id;
@ElementCollection
@CollectionTable( name = "Group" )//this sends an exception
@Column( name = "places_availables" )
private List<Integer> places = new ArrayList<Integer>();
}
我想知道是否有办法阻止 Hibernate 生成新的 table 并在 Group
table 中添加一个新列。
非常感谢
我回来了一个解决方案,我在保存之前将列表转换为字符串,然后在从数据库中检索它时进行反向操作。
我有这个实体:
@Entity
@Table( name = "Group" )
public class Group implements Serializable {
@Id
private Long id;
@ElementCollection
@CollectionTable( name = "Group" )//this sends an exception
@Column( name = "places_availables" )
private List<Integer> places = new ArrayList<Integer>();
}
我想知道是否有办法阻止 Hibernate 生成新的 table 并在 Group
table 中添加一个新列。
非常感谢
我回来了一个解决方案,我在保存之前将列表转换为字符串,然后在从数据库中检索它时进行反向操作。