Disabling the EclipseLink shared object cache

The EclipseLink shared object cache contains a subset of all objects that are read and persisted for the persistence unit. The EclipseLink shared cache differs from the local EntityManager/L1/persistence context cache. The shared cache exists during the persistence unit and is shared by all EntityManagers and users of the persistence unit.

If you are migrating an existing application or running an environment where your application spans multiple Java Virtual Machines (JVMs), you can disable the EclipseLink shared object cache.

Choose one of the following ways to disable the EclipseLink shared object cache.


  • Set the <shared-cache-mode>NONE</shared-cache-mode> property in the persistence.xml file.
    <persistence-unit name="pu">     
            <shared-cache-mode>NONE</shared-cache-mode>
            <properties>
    ...
            </properties>
    </persistence-unit>
  • Set the eclipselink.cache.shared.default property to false in the persistence unit definition that is found in the persistence.xml file.
    <persistence-unit name="pu">
            <properties>
                <property name="eclipselink.cache.shared.default" value="false" />
    ...
            </properties>
    </persistence-unit>