Resolved recently

Uninitialized HibernateProxy mapped as NO_PROXY gets initialized when reloaded with enhancement-as-proxy enabled

Description

This bug affects the following combination:

  • enhancement-as-proxy is enabled;

  • a lazy to-one association is mapped with @LazyToOne(LazyToOneOption.NO_PROXY);

  • the association is with an entity of a Class that has subclasses;

  • the association is loaded as a HibernateProxy via EntityType#resolveIdentifier;

  • the same proxy is later re-loaded for another association or by Session#load or Session#getReference.

In EntityType#resolveIdentifier, when the HibernateProxy is returned by Session#internalLoad, it sets HibernateProxy#setUnwrap( true ) in this code.

Later, when the same HibernateProxy is retrieved from StatefulPersistenceContext by DefaultLoadEventListener#proxyOrLoad, it gets initialized by this code.

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Gail Badner

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.4.5

Priority

Major
Configure