1.4K Star 5.1K Fork 1.8K

GVP红薯/J2Cache

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

Hibernate 5 支持模块

基于 Hibernate 5.2.17 开发,感谢 @tandy

Maven:

<dependency>
  <groupId>net.oschina.j2cache</groupId>
  <artifactId>j2cache-hibernate5</artifactId>
  <version>1.0.0-beta1</version>
</dependency>

使用说明:

1、XML文件配置

    <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
        <property name="hibernateProperties">
            <props>
                ...省略其他配置...
                <prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate5.SpringSessionContext</prop>
                <prop key="hibernate.cache.region.factory_class">net.oschina.j2cache.hibernate5.J2CacheRegionFactory</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.use_query_cache">true</prop>
            </props>
        </property>
        ...省略其他配置...
    </bean>

2、properties文件配置

    spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
    spring.jpa.properties.hibernate.cache.region.factory_class=net.oschina.j2cache.hibernate5.J2CacheRegionFactory
    spring.jpa.properties.hibernate.cache.use_second_level_cache=true
    spring.jpa.properties.hibernate.cache.use_query_cache=true

3、yml文件配置

    spring:
        jpa:
            properties:
                hibernate:
                    current_session_context_class: org.springframework.orm.hibernate5.SpringSessionContext
                    cache:
                        use_second_level_cache: true
                        use_query_cache: true
                        region:
                            factory_class: net.oschina.j2cache.hibernate5.J2CacheRegionFactory
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/ld/J2Cache.git
git@gitee.com:ld/J2Cache.git
ld
J2Cache
J2Cache
master

Search