Hibernate Get and load method -


i have basic understanding of both methods have few concerns load() method: 1. if class final or default constructor not provided ,in case load hit database or throw error it’s not able create proxy class? 2. if object found in first or second level cache , return full object or proxy object?

for method 1. if finds object in cache not hit database?

as per understanding,

load hits cache , get tries hit cache.

if load gets object in cache returns, if not, returns proxy object given identifier set.

if get, gets object cache returns, if not, goes db , returns found object, if not present returns null.

incase of load, if returns proxy object, throws org.hibernate.objectnotfoundexception while saving/updating object, when identifier of object queried not present in database.

so use load when sure have object against queried identifier in database, it's use should need update few attributes.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -