Hazelcast as hibernate cache and service Cache

Source: Internet
Author: User

First, gemfire has concepts such as locator. The gemfire-hibernate module is also officially available. But it is strange that various configuration errors are reported. Then @ Wu yongzhi, a netizen in the previous comment on the log, mentioned hazelcast. So try again. The results were surprisingly smooth. Record the process. 1. download and run hazelcast and decompress it. In fact, run bin/server. bat directly. However, in order to be able to see the actual situation, the mancenter. war in the package was first found and deployed, and bin/hazelcast. xml was modified to open the management-center. And point to the access path of the deployed mancenter. Then start the hazelcast service: bin/server. bat. 2. hibernate second-level cache and query cache I use spring in combination with hibernate, but not jpa. The configuration is as follows: 1 <bean id = "sessionFactory" 2 class = "org. springframework. orm. hibernate3.annotation. annotationSessionFactoryBean "> 3 <property name =" dataSource "> 4 <ref bean =" dataSource "/> 5 </property> 6 <property name =" packagesToScan "> 7 <list> 8 <value> com. my. **. model </value> 9 </list> 10 </property> 11 <property name = "hibernateProperties"> 12 <props> 13 <prop key = "hibernate. dialect ">$ {hibernate. dialect} </p Rop> 14 <prop key = "hibernate. show_ SQL ">$ {hibernate. show_ SQL} </prop> 15 <prop key = "hibernate. jdbc. fetch_size ">$ {hibernate. jdbc. fetch_size} </prop> 16 <prop key = "hibernate. jdbc. batch_size ">$ {hibernate. jdbc. batch_size} </prop> 17 <prop key = "hibernate. hbm2ddl. auto ">$ {hibernate. hbm2ddl. auto} </prop> 18 <prop key = "hibernate. cache. use_second_level_cache ">$ {hibernate. cache. use_second_level_cache} </prop> 19 <prop k Ey = "hibernate. cache. use_query_cache ">$ {hibernate. cache. use_query_cache} </prop> 20 <prop key = "hibernate. validator. autoregister_listeners ">$ {hibernate. validator. autoregister_listeners} </prop> 21 <prop key = "hibernate. validator. apply_to_ddl ">$ {hibernate. validator. apply_to_ddl} </prop> 22 <prop key = "javax. persistence. validation. mode ">$ {javax. persistence. validation. mode} </prop> 23 24 <prop key = "hibernate. cac He. region. factory_class ">$ {hibernate. cache. region. factory_class} </prop> 25 <prop key = "hibernate. cache. use_minimal_puts ">$ {hibernate. cache. use_minimal_puts} </prop> 26 <prop key = "hibernate. cache. hazelcast. use_native_client ">$ {hibernate. cache. hazelcast. use_native_client} </prop> 27 <prop key = "hibernate. cache. hazelcast. native_client_address ">$ {hibernate. cache. hazelcast. native_client_address} </prop> 28 <pro P key = "hibernate. cache. hazelcast. native_client_group ">$ {hibernate. cache. hazelcast. native_client_group} </prop> 29 <prop key = "hibernate. cache. hazelcast. native_client_password ">$ {hibernate. cache. hazelcast. native_client_password} </prop> 30 </props> 31 </property> 32 </bean> followed by the properties configuration file: 1 hibernate. dialect = org. hibernate. dialect. mySQL5InnoDBDialect 2 hibernate. show_ SQL = true 3 hibernate. jdbc. fetch_siz E = 25 4 hibernate. jdbc. batch_size = 30 5 hibernate. hbm2ddl. auto = update 6 hibernate. cache. region. factory_class = com. hazelcast. hibernate. hazelcastCacheRegionFactory 7 hibernate. cache. use_query_cache = true 8 hibernate. cache. use_second_level_cache = true 9 www.2cto. com10 hibernate. validator. autoregister_listeners = false11 hibernate. validator. apply_to_ddl = false12 javax. persistence. validation. mode = none13 14 hib Invalid. cache. use_minimal_puts = true15 hibernate. cache. hazelcast. use_native_client = true16 hibernate. cache. hazelcast. native_client_address = localhost17 hibernate. cache. hazelcast. native_client_group = dev18 hibernate. cache. hazelcast. native_client_password = dev-pass and then OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.