Package org.hibernate.annotations

Enum Class CacheLayout

java.lang.Object
java.lang.Enum<CacheLayout>
org.hibernate.annotations.CacheLayout
All Implemented Interfaces:
Serializable,Comparable<CacheLayout>,Constable

@Incubatingpublic enumCacheLayoutextendsEnum<CacheLayout>
Describes the data layout used for storing an object into the query cache.

The query cache can either store the full state of an entity or collection, or store only the identifier and discriminator if needed. Both approaches have pros and cons, but ultimately it's advisable to us a shallow layout if the chances are high, that the object will be contained in the second level cache.

Since:
6.5
See Also:
  • Enum Constant Details

    • AUTO

      public static final CacheLayout AUTO
      Uses eitherSHALLOW orFULL, depending on whether an entity or collection is second level cacheable.
    • SHALLOW

      public static final CacheLayout SHALLOW
      Uses a cache layout that only stores the identifier of the entity or collection. This is useful when the chances for the object being part of the second level cache are very high.
    • SHALLOW_WITH_DISCRIMINATOR

      public static final CacheLayout SHALLOW_WITH_DISCRIMINATOR
      LikeSHALLOW but will also store the entity discriminator.
    • FULL

      public static final CacheLayout FULL
      Stores the full state into the query cache. This is useful when the chances for the object being part of the second level cache are very low.
  • Method Details

    • values

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

      public static CacheLayout valueOf(String name)
      Returns the enum constant of this class with the specified name.The string must matchexactly an identifier used to declare anenum 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