PersistenceContext can get cleared before load completes using StatelessSessionImpl

Description

When an association gets loaded eagerly by {{StatelessSessionImpl#internalLoad}} calling {{StatelessSessionImpl#get}}, {{temporaryPersistenceContext}} may get cleared before the load is complete. If this happens, Hibernate will not find an expected {{EntityEntry}}, and {{TwoPhaseLoad#afterInitialize}} will throw a {{NullPointerException}}.

The test case for caused the {{NullPointerException}} because there was a bug that caused a lazy association to be loaded eagerly. Once that bug was fixed by HHH-13633, the problem was no longer reproduced by that test case.

Modifying that test case to make the association eager reproduced this issue again.


Original description:

A test case added for throws NullPointerException.

found that this commit for caused the NPE.

Environment

None

Assignee

Gail Badner

Reporter

Gail Badner

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure