Currently session auto-closing is driven solely by
Settings.isAutoCloseSessionEnabled(), which in turn comes from
'hibernate.transaction.auto_close_session' setting. The problem is
that in cases where the session is "owned" (HEM and Envers are 2 such
cases) the answer is not always as simple as an a priori boolean flag.
That is the case Gail is trying to solve. To be honest I have not yet
looked at the pull request to answer your specifics. But I will look
at it and apply it prior to 4.1.3 tomorrow.
On Tue 01 May 2012 09:15:51 AM CDT, Scott Marlow wrote:
Is this the safest way to fix?
Not sure what you mean by "safest" way to fix.
1. The patch is changing the serialization of Hibernate Sessions to
include the session owner. Where is org.hibernate.SessionOwner? Is
org.hibernate.SessionOwner always serializable? Could
org.hibernate.SessionOwner reference anything that could be
problematic for serialization?
If the person supplying the Session wishes it to be Serializable then
yes. That is the responsibility of the thing supplying the
SessionOwner. In most cases this is Hibernate code itself. Then main
use case being the Hibernate EntityManager as the SessionOwner. And
yes, the Hibernate EntityManagerImpl is Serializable, although perhaps
only partially iiuc (AbstractEntityManagerImpl is Serializable;
EntityManagerImpl extends AbstractEntityManagerImpl but then adds extra
2. AbstractSessionImpl doesn't have a serialVersionUID but with
change to the Session serialization, I'm wondering if it should.
serialVersionUID is only ever useful in terms of attempts to ser/deser
sessions using different versions of Hibernate. That is expressly not
As for the rest of your questions, I have not looked at the code so I
cannot answer specifically.