Enum Class SharedCacheMode

java.lang.Object
java.lang.Enum<SharedCacheMode>
jakarta.persistence.SharedCacheMode
All Implemented Interfaces:
Serializable, Comparable<SharedCacheMode>, Constable

public enum SharedCacheMode extends Enum<SharedCacheMode>
Enumerates policies which control how the provider determines if an entity type is eligible for storage in the second-level cache.

A SharedCacheMode may be specified by the <shared-cache-mode> element of persistence.xml or by calling PersistenceConfiguration.sharedCacheMode(SharedCacheMode).

Since:
2.0
See Also:
  • Enum Constant Details

    • ALL

      public static final SharedCacheMode ALL
      Every entity type associated with the persistence unit and all entity-related state and data is eligible for storage in the second-level cache.
    • NONE

      public static final SharedCacheMode NONE
      The second-level cache is disabled for the whole persistence unit. No entity type is eligible for storage in the second-level cache.
    • ENABLE_SELECTIVE

      public static final SharedCacheMode ENABLE_SELECTIVE
      An entity type is eligible for storage in the second-level cache if and only if it is annotated Cacheable or Cacheable(true).
    • DISABLE_SELECTIVE

      public static final SharedCacheMode DISABLE_SELECTIVE
      An entity type is eligible for storage in the second-level cache if and only if it is not annotated Cacheable(false).
    • UNSPECIFIED

      public static final SharedCacheMode UNSPECIFIED
      The persistence provider determines if an entity type is eligible for storage in the second-level cache, according to vendor-specific semantics.
  • Method Details

    • values

      public static SharedCacheMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SharedCacheMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null