1. OpenJPA
  2. OPENJPA-1532

Should the <shared-cache-mode> element in a persistence unit definition automatically turn on the data cache?


    • Type: Question Question
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.1.0, 2.2.0
    • Fix Version/s: 2.2.2, 2.3.0
    • Component/s: datacache
    • Labels:


      The JPA 2.0 spec introduces a new persistence unit definition element, <shared-cache-mode>, which accepts NONE, ALL, ENABLE_SELECTIVE, and DISABLE_SELECTIVE. The JPA 2.0 spec section 3.7.1 documents the behavior of each of those modes.

      What I am curious about is if the use of <shared-cache-mode> should implicitly enable OpenJPA's data cache plugin. Currently, the above element is completely ignored if the persistence unit is missing the properties: openjpa.DataCache=true and openjpa.RemoteCommitProvider=sjvm (because by default, OpenJPA disables data caching). My interpretation of the spec suggests that <shared-cache-mode> is not only a platform-independent method of instructing the data cache which entities are eligible for admittance to the data cache, but it is also a switch providing a platform-independent method of both turning the data cache on or off (since whether the cache is enabled by default is platform-specific). Otherwise, why have a NONE value, if it was not intended to be a platform independent means of turning the data cache off?

      1. OPENJPA-1532.patch
        56 kB
        Helen Xu
      2. OPENJPA-1532.patch.txt
        19 kB
        Michael Dick
      3. OPENJPA-1532-Doc.patch
        4 kB
        Helen Xu
      4. OPENJPA-1532-MigrationDoc.patch
        1 kB
        Helen Xu


        No work has yet been logged on this issue.


          • Assignee:
            Rick Curtis
            Jody Grassel
          • Votes:
            0 Vote for this issue
            3 Start watching this issue


            • Created: