java - Hibernate post load event listener - not all data present -


hibernate version 4.3.10-final

i have entity called account declares child transaction table follows

@onetomany(cascade = cascadetype.all, mappedby = "account", orphanremoval = true) @orderby("transactiondate desc") private set<transaction> transactionlist; 

transaction list lazily loaded hibernate loads when needed. perform actions in post load event works fine when load account object, when hibernate loads transaction list (when code accesses transaction list, not happen every time), post load event account. in case post load data not correctly set account. example in following code, logs show key, deep inside hibernate loads account again when gettransactionlist called, same account object can not access key. getuser not return null, not loaded either - happenning on loaded object.

    final string key = account.getuser().getkey();      if (log.isinfoenabled()) {         log.info("got key {}", key);     }     (final transaction transaction : account.gettransactionlist())   {       //   } 

how ensure post load work correctly?


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -