tag:blogger.com,1999:blog-8712770457197348465.post6100763265165833703..comments2024-03-19T05:51:39.935-07:00Comments on Javarevisited: Difference between get and load in Hibernatejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8712770457197348465.post-9505476761264440842016-02-23T18:32:37.320-08:002016-02-23T18:32:37.320-08:00Is this sentence correct "if any method other...Is this sentence correct "if any method other than getId() is called on persistent or entity object",<br />As i believe it will hit database if we try to access any of its object?? <br />Please correct me if i am wrong.<br /><br />Unknownhttps://www.blogger.com/profile/08122217364167570849noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-30743466523111323492013-05-17T00:23:47.246-07:002013-05-17T00:23:47.246-07:00<>
check above line in option 4. Performance...<><br />check above line in option 4. Performance.<br />I think it should be instead of failing immediately so not a "fail safe" behavior<br />OR I think it should be instead of failing immediately so its a "fail fast" behavior.<br />Tell me if I'm wrong..<br />DattaDTshttps://www.blogger.com/profile/02144139046446699786noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-40457568061998474762013-05-09T00:48:21.281-07:002013-05-09T00:48:21.281-07:00@Above
In that case if i get proxy object from se...@Above<br /><br />In that case if i get proxy object from session when i use get() and if i call get properties of my object will it hit DB? when we use load proxy object will hit DB when we call getter properties of my obj.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-2069158074520333782012-07-22T19:31:56.858-07:002012-07-22T19:31:56.858-07:00Actually , get() does not always hit database , a...Actually , get() does not always hit database , and it can return a proxy . <br /><br />Like what you said , get() will only hit DB if the object doesn't exists in Session Cache. Hibernate will first check if the same object , no matter it is the real object or proxy , exist in the session cache first . If yes , just return that object .If not , hit database to get it . So after a new Anonymousnoreply@blogger.com