Allow enhanced entities to be returned in a completely uninitialized state

Description

When EntityManager#getReference is called to obtain reference to an entity, currently what happens is:

  • If the entity is proxied we will load no state and the uninitialized entity reference is returned

  • If the entity is enhanced we load its non-lazy state immediately.

This is a request to allow the enhanced entity to be returned without even its non-lazy state yet loaded


Original description

When using bytecode enhanced entities EntityManager.getReference does not seem to return a proxy but a fully initialized entity just like EntityManager.find.
The example project comes with two maven profiles, the default activated one does enhancement. You can disable enhancement with the profile no-enhancement to see how it succeeds with non-enhanced entities.

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Christian Beikov

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major