Tuesday, December 30, 2014

How hibernate get() and load() will work when query 2nd time




How hibernate get() and load() will work when query second times? Please correct me




get() -> 1) Check 1st Level Cache and 2) DB hit



load() -> 1) Check 1st Level Cache 2) Then 2nd Level Cache Then 3) DB hit



How it will work?




Suppose, I updated(or added) the record using native sql or diectly in the dabase means, how get() and load() will get the latest changes?




If that is the case, hibernate will update the cache automatically or we need to the fresh query to fill the cache( againg qury or session.refresh()?







No comments:

Post a Comment