programmatic hazelcast configuration for spring 4 / hibernate 5 second level cache

242 views
Skip to first unread message

lars...@gmail.com

unread,
Aug 22, 2016, 1:00:50 PM8/22/16
to Hazelcast
Hi all,

I have a Spring 4/Hibernate 5 app where I use hazelcast as my second level Hibernate cache with TCP joining using the HazelcastLocalCacheRegionFactory. It all works well when hazelcast loads configuration from a hazelcast.xml config file on the application classpath.

What I am trying to achieve now is external configuration of members of the TCP cluster. I am aware that I can set a system property for the app to look for an external hazelcast.xml file. However, we have a dedicated configuration file for our app and I would like to integrate the hazelcast cluster member config there, to make it simpler to set up and avoid having a second config file.

I have experimented with the following options:

- The hazelcast spring configuration namespace. The problem seems to be that Spring/Hibernate does not pick it up when starting the HazelcastLocalCacheRegionFactory. In Spring Hibernate 4 there is a property which allows for injecting a "cacheRegionFactory" on the LocalSessionFactoryBean but this does not seem to be there for the Spring Hibernate 5 integration.

- Using Java programmatic configuration where I retrieve the HazelcastInstance and modify it. The problem seems to be that a configuration cannot be modified once it's created.


So to summarize, I am looking to specify the hazelcast config during startup of my app (reading from my config file). Could take place in a spring managed bean or in spring namespace.

Are there anyone who know how to programatically configure hazelcast for hibernate second level cache using Spring 4.2 and Hibernate 5 ?


Details:

Spring version: 4.2.5.RELEASE
spring-orm: 4.2.5.RELEASE
Hibernate version: 5.1.0.Final
hazelcast version: 3.6.4
hazelcast-spring version: 3.6.4
hazelcast-hibernate5 version: 1.0



Replies would be greatly appreciated.


best regards,

Lars

Mesut Celik

unread,
Aug 23, 2016, 5:54:45 AM8/23/16
to haze...@googlegroups.com
Hibernate 5 has changed the contract which triggered a change in hibernate-spring integration...
That is something we should figure out. 

Can you please create a new issue for it?

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+unsubscribe@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/229b129a-ab9b-4f58-a991-26a0edae9ead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Mesut Celik
Services & Integration Team Lead 
Mahir İz Cad. No:35, Altunizade, İstanbul 
me...@hazelcast.com 

lars...@gmail.com

unread,
Aug 23, 2016, 8:14:31 AM8/23/16
to Hazelcast


On Tuesday, August 23, 2016 at 11:54:45 AM UTC+2, Mesut Celik wrote:
Hibernate 5 has changed the contract which triggered a change in hibernate-spring integration...
That is something we should figure out. 

Can you please create a new issue for it?


Sure. I have done it now here:


Many thanks for the reply.

best regards,

Lars


 
Reply all
Reply to author
Forward
0 new messages