Use Hazelcast as EclipseLink 2nd level cache

Hello there,

I am experimenting with Hazelcast in Payara.

I thought it could be an awesome tool for sharing JPA cached objects between Payara instances - all joined in the Data Grid.

My question is: can Hazelcast be used as the 2nd Level cache for EclipseLink?

I have seen at least 2 Closed issues on your GitHub regarding this matter (here and here) but even after reading the discussion I cannot understand whether you have implemented this or not and how it is done.

Did you manage to do it? Can it be used already?

Thanks.

Hi,

If you use payara to create a cluster it works fine. I wanted to run two payara DAS instances and also got it working.

Regards, Hans

Hello Hans and thank you for your answer.

While I get your point, what I mean is a bit further from that.

One thing is Cache Coordination, it means that each Application deployed in a Payara instance will try to coordinate the changes made to the cache in one App to all the others connected.

What I was inquiring was rather whether Hazelcast can be used as the actual 2nd level cache for EclipseLink’s entities and queries. This means there would be ONE cache, which is saved (and replicated) on Hazelcast and so, shared between all applications connected in the same cluster.

In short, similar to what it seems to be possible with Hibernate (see here)

This is something with great potential and wouldn’t need coordination because it would be shared among all instances and coordinated centrally on Hazelcast.

Is this currently doable on Payara?

Hi @CarlosGoncalves,

I have linked documentation to configuring Hazelcast cache coordination for Eclipselink which should achieve your desired outcome, however I appreciate this documentation is brief and would benefit from some improvements in the future.

https://docs.payara.fish/community/docs/Technical%20Documentation/Payara%20Server%20Documentation/Jakarta%20EE%20API/JPA/JPA%20Cache%20Coordination.html

Best Regards,
James