Quote:
Even just accessing the ID of an instance may cause lazy loading
No, it doesn't, as is documented in
http://docs.jboss.org/hibernate/stable/ ... ng-proxies (final part just before section 20.1.4)
And since the session.get() method is used this should mean that at least the "someObject" entity is initialized so it should be safe to read other properties than the id (assuming that no properties have been declared as lazy).
Quote:
detach the entity from the session, by removing it from the session or closing the session
This will not work if accessing uninitialized proxies or collections. If the entity is detached it will result in a LazyInitializationException. The code example in the original post seems to suggest that the transaction is committed and the session is closed. So the thread actually has a reference to a detached object. And this is probably a "good" thing since a LazyInitializationException is easier to fix than some strange errors that only happen sometimes due to threading issues.
It might be better to move the commit and close to before the thread is started though.