EntityManager.getMetaModel().entity throws "Not an entity" for a proxy class

Description

Code uses getClass() on an entity lazily loaded by Hibernate (JPA). It then calls entityManager.getMetaModel().entity() with that class.
This method fails because the class is looked up immediately in the entity map, and the proxy class is not there.

The code should recognize that the class is a proxy, and determine the real class from that.

The workaround is to use Hibernate.getClass() on the instance but that creates a hard dependency and is non-obvious.

Environment

Oracle 11g 11.2.0.3 et al

Assignee

Unassigned

Reporter

Frits Jalvingh

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure