i have two entities :
public class Products {
@OneToMany(mappedBy = "product")
private Set<StockedProducts> stockedProducts;
}
public class StockedProducts {
@Id
@ManyToOne (cascade = CascadeType.MERGE)
@JoinColumn(name = "productId", foreignKey = @ForeignKey(name = "fk_product"), referencedColumnName = "id" )
private Products product;
The Products and StockedProducts are linked with a one to many relationship.
when i fetch the data from the StockedProducts side it fetches the associated Products entity normally.But when i fetch data from the Products side the StockedProducts entity comes up empty. From what i understand the fetch type is set to lazy by default but even when i declare it as eagre it still returns the set empty.
New contributor
Azedine BAKA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.