何时/如何以编程方式设置Hibernate大小使用的Ehcache


v-star*위위
2025-03-11 06:54:48 (10天前)


我通过添加以下内容在Hibernate 4.3.11中启用了二级缓存:

config.setProperty(“hibernate.cache.region.factory_class”,“org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory”);
配置….

2 条回复
  1. 0# 你瞎啊!撞我心了 | 2019-08-31 10-32



    你可以继承

    org.hibernate.cache.ehcache.EhCacheRegionFactory

    并手动执行任何缓存配置,然后告诉Hibernate使用您的自定义缓存工厂:




    1. Configuration.setProperty(“hibernate.cache.region.factory_class”, my.cache.FactoryClass”);

    2. </code>


    看到:

    http://www.ehcache.org/documentation/2.7/integrations/hibernate.html#set-the-hibernate-cache-provider-programmatically-


登录 后才能参与评论