“cannot simultaneously fetch multiple bags”的解决方法
程序员文章站
2022-02-12 21:23:49
...
@OneToMany(mappedBy = "customer",cascade = {CascadeType.ALL},fetch = FetchType.LAZY)
private Collection<CartItem> cartItems;
@OneToMany(mappedBy = "customer",cascade = {CascadeType.ALL},fetch = FetchType.EAGER)
private Collection<BookOrder> orders ;
在用JPA进行注释时,如果一个实体里要映射多个集合实体时,我们不能把两个集合的的FetchType设置为EAGER,此时只能设置为LAZY,否则会报:cannot simultaneously fetch multiple bags。或者我们也可以借助:@IndexColumn
上一篇: 用AOP管理日志
下一篇: Service层的单元测试
推荐阅读
-
2010.04.08———cannot simultaneously fetch multiple bags异常
-
jpa cannot simultaneously fetch multiple bags OneToMany
-
Hibernate抓取策略以及如何避免cannot simultaneously fetch multiple bags异常
-
JPA的cannot simultaneously fetch multiple bags异常的解决
-
使用Hibernate 过程中 报—— cannot simultaneously fetch multiple bags
-
hibernate exception (cannot simultaneously fetch multiple bags)
-
“cannot simultaneously fetch multiple bags”的解决方法