private List < Object > doQueryAndInitializeNonLazyCollections ( SharedSessionContractImplementor session , QueryParameters qp , OgmLoadingContext ogmLoadingContext , boolean returnProxies ) { //TODO handles the read only final PersistenceContext persistenceContext = session . getPersistenceContext ( ) ; boolean defaultReadOnlyOrig = persistenceContext . isDefaultReadOnly ( ) ; persistenceContext . beforeLoad ( ) ; List < Object > result ; try { try { result = doQuery ( session , qp , ogmLoadingContext , returnProxies ) ; } finally { persistenceContext . afterLoad ( ) ; } persistenceContext . initializeNonLazyCollections ( ) ; } finally { // Restore the original default persistenceContext . setDefaultReadOnly ( defaultReadOnlyOrig ) ; } log . debug ( "done entity load" ) ; return result ; }
Load the entity activating the persistence context execution boundaries