I'm in the process of migration from Hibernate 5.6 to 6.2. I have a utility class that via a deprecated call to
entityManager.unwrap(Session.class).getSessionFactory().getClassMetadata(clazz)
was obtaining an instance of AbstractEntityPersister
with which I had access to methods like:
What is the proper way to have access to these methods in Hibernate 6? Is there another recommended API alternative to all these methods?
What I tried was working with entityManager.getMetamodel().managedType(clazz)
but I only had partial success, or access to methods that seem to only help me do my own implementation of the needed methods.
This is worked for me
AbstractEntityPersister persister = ((AbstractEntityPersister) ((MappingMetamodel) sessionFactory.getMetamodel()).getEntityDescriptor(clazz));