Hello,
First time posting so please bear with me. I am just learning hibernate and I am getting a little confused by the difference between 'load' and 'get'. I understand that 'load' returns a proxy while 'get' returns the concrete instance. I can see the debugger variable types. However, why does hibernate execute the complete SQL select during both load and get? If it has already executed the complete SQL why not just always return the concrete instance instead of proxy?
My second question is regarding lazy='proxy' and lazy='noproxy'. From the documentation I see that when a single valued association is related by lazy='proxy' then the only time the object gets loaded is when we access the associated object methods other than the identifier. However, in my debugger I see that for lazy='proxy' when the associated object identifier is accessed the SQL is still run in the database. Why does this happen and what advantage does it give over lazy='noproxy'?
I will really appreciate any response.
Thanks in advance.
Shan
|