SessionImpl not all transient fields are restored after de-serialization. Leads to nullpointers

Description

We are using hibernate jpa in combination with spring webflow and when the hibernate session gets de-serialized we get nullpointers due to the exceptionmapper being null.

The problem seems to be situated in org.hibernate.internal.SessionImpl readObject method which doesn't restore the exceptionMapper field. It looks like there may be other fields not being restored; better review them too.

Fields to review:

  • exceptionMapper

  • managedFlushChecker

  • loadEvent

  • afterCompletionAction

  • discardOnClose

  • autoClear

  • autoClose

  • dontFlushFromFind

  • disallowOutOfTransactionUpdateOperations

  • sessionOwner

Possibly this is a bug due to the way jpa and hibernate are integrated. (non standard)
However just looking at the source code seems like the transient fields should be restored in the readObject method
Alternatively the session shouldn't be serializable but I think that will break much more since third parties probably rely on this feature...

Environment

None

Activity

Show:
Pas Filip
March 10, 2017, 4:02 PM

Similar to

Assignee

Unassigned

Reporter

Pas Filip

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure