I just read the API documentation (I quoted it below) and I am curious when would you use Session.load over Session.get? When would you want a situation where hibernate returns a proxied object that represents nothing?
Quote:
Session.get:
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance, or a proxy for the instance, is already associated with the session, return that instance or proxy.)
Quote:
Session.load:
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.
You should not use this method to determine if an instance exists (use get() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.
Regards,
Joshua