All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.cache.redis.hibernate5.util.HibernateCacheUtil Maven / Gradle / Ivy

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 "";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy