My Tables:
Product: id, name
Offer: id, value, product_id
Entities:
@Entity
@Table(name=\"product\"
I am using Eclipselink 2.5.2 version as my ORM vendor and I have faced this issue in one-to-many JPA mapping while lazy loading the containing entities. The workaround that is working for me is:-
final List list = Collections.unmodifiableList(new ArrayList<>
(containerEntity.getContainingEntityList());
The Mapping from Container Entity side is:
@OneToMany(mappedBy = containerEntity, cascade = CascadeType.ALL, fetchType = FetchType.LAZY)
private List containingEntityList;
Mapping from Containing Entity side is:
@ManyToOne
@JoinColumn(name = "container_entity_id")
private ContainerEntity containerEntity;