
Hibernate中怎么用注解配置集合映射,比如 Map<String,String>、String[]、Set<String>等
注意,不是one-to-many之类的关联映射就只是映射集合,在.hbm.xml中的<set.../>、<list.../>、<map.../>、<array.../>等...
注意,不是one-to-many之类的关联映射
就只是映射集合,在.hbm.xml中的<set.../>、<list.../>、<map.../>、<array.../>等
用注解怎么配置
@ElementCollection
Defines a collection of instances of a basic type or embeddable class
@CollectionTable
used for the mapping of collections of basic or embeddable types
在JPA的API里面查到了,可以用上面个两个注解,一个注解基本类型,一个注解组件类型的,不过还是谢谢两位 展开
就只是映射集合,在.hbm.xml中的<set.../>、<list.../>、<map.../>、<array.../>等
用注解怎么配置
@ElementCollection
Defines a collection of instances of a basic type or embeddable class
@CollectionTable
used for the mapping of collections of basic or embeddable types
在JPA的API里面查到了,可以用上面个两个注解,一个注解基本类型,一个注解组件类型的,不过还是谢谢两位 展开
1个回答
展开全部
@ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH})
@JoinTable(name = "suppliers_groups", joinColumns = { @JoinColumn(name = "supplierId") }, inverseJoinColumns = { @JoinColumn(name = "childGroupId") })
@OrderBy("id")
private Set<ChildGroup> childGroups;
//其他的类似
@JoinTable(name = "suppliers_groups", joinColumns = { @JoinColumn(name = "supplierId") }, inverseJoinColumns = { @JoinColumn(name = "childGroupId") })
@OrderBy("id")
private Set<ChildGroup> childGroups;
//其他的类似
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询