Key / Id Property ermitteln#

Session session = (Session)entityManager.getDelegate();
ClassMetadata metadata = session.getSessionFactory().getClassMetadata(type);
String keyName = metadata.getIdentifierPropertyName();
Class<?> keyType = metadata.getIdentifierType().getReturnedClass();