Using Hazelcast EclipseLink Cache Coordination Protocol
Configure persistence.xml
as follows:
-
Set
eclipselink.cache.coordination.protocol
property tofish.payara.persistence.eclipselink.cache.coordination.HazelcastPublishingTransportManager
-
Add
eclipselink.cache.coordination.channel
property
The channel property is optional, but is highly recommended if the application has more than one Persistence Unit. Best practice is to name the channel after the persistence unit.
Here is a complete example:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="MyPU" transaction-type="JTA">
<jta-data-source>jdbc/myDataSource</jta-data-source>
<shared-cache-mode>DISABLE_SELECTIVE</shared-cache-mode>
<properties>
<property name="eclipselink.cache.coordination.protocol" value="fish.payara.persistence.eclipselink.cache.coordination.HazelcastPublishingTransportManager"/>
<property name="eclipselink.cache.coordination.channel" value="MyPUChannel"/>
</properties>
</persistence-unit>
</persistence>