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.
Oracle 11g 22.214.171.124 et al