parent
3b19661b2c
commit
e7ad69d09c
|
@ -70,6 +70,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
* Unlike the {@linkplain jakarta.persistence.Id primary identifier}
|
||||
* of an entity, a natural id may be {@linkplain #mutable}.
|
||||
* <p>
|
||||
* On the other hand, a field or property which forms part of a natural
|
||||
* id may never be null, and so it's a good idea to use {@code @NaturalId}
|
||||
* in conjunction with the Bean Validation {@code @NotNull} annotation
|
||||
* or {@link jakarta.persistence.Basic#optional @Basic(optional=false)}.
|
||||
* <p>
|
||||
* The {@link org.hibernate.Session} interface offers several methods
|
||||
* that allow an entity instance to be retrieved by its
|
||||
* {@linkplain org.hibernate.Session#bySimpleNaturalId(Class) simple}
|
||||
|
@ -78,12 +83,12 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
* NaturalIdCache natural id caching}, then these methods may be able
|
||||
* to avoid a database round trip.
|
||||
*
|
||||
* @author Nicol<EFBFBD>s Lichtmaier
|
||||
* @author Nicolás Lichtmaier
|
||||
*
|
||||
* @see NaturalIdCache
|
||||
*/
|
||||
@Target( { METHOD, FIELD } )
|
||||
@Retention( RUNTIME )
|
||||
@Target({METHOD, FIELD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface NaturalId {
|
||||
/**
|
||||
* Specifies whether the natural id is mutable or immutable.
|
||||
|
|
Loading…
Reference in New Issue