When lazy fetching a child entity outside the session that loaded the parent entity, hibernate will open a temporary session if "hibernate.enable_lazy_load_no_trans" is set to true. As part of this it opens a temporary session & then sets the transaction to read only. However, after lazyInitializationWork.doWork() in the finally block it fires a commit() if we are in nonJTA environment. This to me looks like it can be avoided. |