程序包 org.hibernate
接口 SimpleNaturalIdLoadAccess<T>
-
public interface SimpleNaturalIdLoadAccess<T>Loads an entity by its natural identifier.- 作者:
- Eric Dalquist, Steve Ebersole
- 另请参阅:
NaturalId,NaturalIdLoadAccess
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 TgetReference(Object naturalIdValue)Return the persistent instance with the given natural id value, assuming that the instance exists.Tload(Object naturalIdValue)Return the persistent instance with the given natural id value, ornullif there is no such persistent instance.Optional<T>loadOptional(Serializable naturalIdValue)Same semantic asload(java.lang.Object)except that hereOptionalis returned to handle nullability.SimpleNaturalIdLoadAccess<T>setSynchronizationEnabled(boolean enabled)For entities with mutable natural ids, should Hibernate perform "synchronization" prior to performing lookups?SimpleNaturalIdLoadAccess<T>with(LockOptions lockOptions)Specify theLockOptionsto use when retrieving the entity.
-
-
-
方法详细资料
-
with
SimpleNaturalIdLoadAccess<T> with(LockOptions lockOptions)
Specify theLockOptionsto use when retrieving the entity.- 参数:
lockOptions- The lock options to use.- 返回:
this, for method chaining
-
setSynchronizationEnabled
SimpleNaturalIdLoadAccess<T> setSynchronizationEnabled(boolean enabled)
For entities with mutable natural ids, should Hibernate perform "synchronization" prior to performing lookups? The default is to perform "synchronization" (for correctness). SeeNaturalIdLoadAccess.setSynchronizationEnabled(boolean)for detailed discussion.- 参数:
enabled- Should synchronization be performed?trueindicates synchronization will be performed;falseindicates it will be circumvented.- 返回:
this, for method chaining
-
getReference
T getReference(Object naturalIdValue)
Return the persistent instance with the given natural id value, assuming that the instance exists. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed. You should not use this method to determine if an instance exists; to check for existence, useload(java.lang.Object)instead. Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.- 参数:
naturalIdValue- The value of the natural-id for the entity to retrieve- 返回:
- The persistent instance or proxy, if an instance exists. Otherwise,
null.
-
load
T load(Object naturalIdValue)
Return the persistent instance with the given natural id value, ornullif there is no such persistent instance. If the instance is already associated with the session, return that instance, initializing it if needed. This method never returns an uninitialized instance.- 参数:
naturalIdValue- The value of the natural-id for the entity to retrieve- 返回:
- The persistent instance or
null
-
loadOptional
Optional<T> loadOptional(Serializable naturalIdValue)
Same semantic asload(java.lang.Object)except that hereOptionalis returned to handle nullability.- 参数:
naturalIdValue- The identifier- 返回:
- The persistent instance, if one, wrapped in Optional
-
-