I have a lazy @ManyToOne column on Purchase defined as:
@ManyToOne(fetch = FetchType.LAZY)
Sale sale = null
However, when I load the entity from db, it gets directly loaded:
Purchase purchase = em.find(Purchase.class, id);
PersistenceUnitUtil unitUtil = em
.getEntityManagerFactory()
.getPersistenceUnitUtil();
System.err.println(unitUtil.isLoaded(purchase, "sale"));
This will return true even though the field should not yet be loaded.
What am I doing wrong?
(Hibernate 4.3.11.Final)