Code example for SessionFactory

Methods: getClassMetadata

0
        super(domainClass);
    } 
     
    public static <T> HibernateEntityInformation<T, ?> getMetadata(Class<T> domainClass, SessionFactory sessionFactory) {
        Assert.notNull(domainClass);
        Assert.notNull(sessionFactory);
 
	    ClassMetadata metadata = sessionFactory.getClassMetadata(domainClass);
 
        if(Persistable.class.isAssignableFrom(domainClass)) {
            return new HibernatePersistableEntityInformation(domainClass, metadata);
        } else { 
            return new HibernateMetamodelEntityInformation(domainClass, metadata);
        } 
    } 
 
    public String getEntityName() {
        Class<?> domainClass = getJavaType();
        Entity entity = domainClass.getAnnotation(Entity.class);
        boolean hasName = null != entity && StringUtils.hasText(entity.name());