我已经用
注释了字段@ManyToOne(fetch= FetchType.EAGER)
@JoinColumn(name = "orders_id")
public Order getOrder() {
return order;
}
从对面我得到了:
@OneToMany(mappedBy = "order", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
public Collection<OrderNewspaper> getOrderNewspapers() { return orderNewspapers; }
当我试图找到实体OrderNewspaper时,我得到了:
找不到例外:
Unable to find models.Order with id 84
确实存在记录,但是在此em.find之前(OrderNewspaper.class,49)我运行em.find(Order.class,84)当我试图通过getOrder获取Order时,一切正常。
造成这种问题的原因是什么?