org.hibernate.cache.redis.hibernate5.util.HibernateCacheUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-redis Show documentation
Show all versions of hibernate-redis Show documentation
Hibernate 2nd cache provider with Redis
package org.hibernate.cache.redis.hibernate5.util;
import org.hibernate.SessionFactory;
import org.hibernate.internal.SessionFactoryImpl;
import org.hibernate.persister.entity.EntityPersister;
/**
* Hibernate 2nd cache Utility class
*
* @author [email protected]
*/
public final class HibernateCacheUtil {
private HibernateCacheUtil() {
}
public static String getRegionName(SessionFactory sessionFactory,
Class entityClass) {
EntityPersister p = ((SessionFactoryImpl) sessionFactory).getEntityPersister(entityClass.getName());
if (p.hasCache()) {
return p.getCacheAccessStrategy().getRegion().getName();
}
return "";
}
}