Shvalb
Shvalb

Reputation: 1933

Initialize SessionFactory with existing Hazelcast instance

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!

Upvotes: 0

Views: 368

Answers (1)

Mesut
Mesut

Reputation: 946

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.

Upvotes: 1

Related Questions