Annotation Type NaturalIdCache


  • @Target(TYPE)
    @Retention(RUNTIME)
    public @interface NaturalIdCache
    Specifies that mappings from the natural id values of the annotated entity to the corresponding entity id values should be cached in the shared second-level cache. This allows Hibernate to sometimes avoid round trip to the database when a cached entity is retrieved by its natural id.

    This annotation is usually used in combination with Cache, since a round trip may only be avoided if the entity itself is also available in the cache.

    See Also:
    NaturalId
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String region
      Specifies an explicit cache region name.
    • Element Detail

      • region

        String region
        Specifies an explicit cache region name.

        By default, the region name is EntityName##NaturalId.

        Default:
        ""