I have a JPA entity Rent that has 1:M relationship with the items that are rented (called "Rentable"). I want that this rentables be lazily loaded, but it seems that they are always loaded, even when I use fetch = FetchType.LAZY. Here is my code:
@Entity
@Table (name = "rent")
public class Rent implements Serializable{
........
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinTable(name = "rent_rentable")
private List <Rentable> rentables = new ArrayList <Rentable> ();
Here is how I load the rents:
from Rent r where r.kunde.id = 83
but I also get the associated rentables too.
Could somebody help me, please? I want the rentables to be lazily loaded!
Thank you!