I have a lazy @ManyToOne buy column defined as:
@ManyToOne(fetch = FetchType.LAZY) Sale sale = null
However, when I load an object 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 if the field is not loaded yet.
What am I doing wrong?
(Hibernate 4.3.11.Final)
source share