0

When my server first loads, it initializes Hazelcast and have an instance.

At a later point, it initializes Hibernate's SessionFactory configured to use Hazelcast has 2nd level cache.

The result is having 2 components that initializes HZ instances.

My question is: Is there a way to pass HZ instance to SessionFactory?

Thank you!

1 Answer 1

1

You can share your named hazelcast instance with Hibernate SessionFactory by using hibernate.cache.hazelcast.instance_name

Here is how to configure named hazelcast instance.

Config config = new Config();
config.setInstanceName( "my-named-hazelcast-instance" );

please check latest documentation for more info.

Sign up to request clarification or add additional context in comments.

4 Comments

is there a way to set instance name in the xml configuration file?
I guess not, I read somewhere that it's only done via code to prevent confusion and misconfigurations.
You can set the instance-name through XML Configuration in 3.6 which is not released yet. github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/…
Nice! guess at this point I will wait for it to be released. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.