Top Description Methods
org.hibernate

public Interface IdentifierLoadAccess<T>

Known Direct Implementers
org.hibernate.internal.SessionImpl.IdentifierLoadAccessImpl
Imports
java.io.Serializable, java.util.Optional, org.hibernate.graph.GraphSemantic, .RootGraph

Loads an entity by its primary identifier.
Authors
Eric Dalquist, Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

the persistent instance or proxy
getReference
(Serializable
The identifier for which to obtain a reference
id
)

Return the persistent instance with the given identifier, assuming that the instance exists.

public T

Returns:

The persistent instance or null
load
(Serializable
The identifier
id
)

Return the persistent instance with the given identifier, or null if there is no such persistent instance.

public Optional<T>

Returns:

The persistent instance, if one, wrapped in Optional
loadOptional
(Serializable
The identifier
id
)

Same semantic as load except that here Optional is returned to handle nullability.

public IdentifierLoadAccess<T>

Returns:

this, for method chaining
with
(LockOptions
The lock options to use.
lockOptions
)

Specify the LockOptions to use when retrieving the entity.

public IdentifierLoadAccess<T>

Returns:

this, for method chaining
with
(CacheMode
The CacheMode to use.
cacheMode
)

Specify the CacheMode to use when retrieving the entity.

public default IdentifierLoadAccess<T>
with(RootGraph<T> graph)

public IdentifierLoadAccess<T>
with(RootGraph<T> graph, GraphSemantic semantic)

Method Detail

getReferenceback to summary
public T getReference(Serializable id)

Return the persistent instance with the given identifier, 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, use load instead. Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.

Parameters
id:Serializable

The identifier for which to obtain a reference

Returns:T

the persistent instance or proxy

loadback to summary
public T load(Serializable id)

Return the persistent instance with the given identifier, or null if 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.

Parameters
id:Serializable

The identifier

Returns:T

The persistent instance or null

loadOptionalback to summary
public Optional<T> loadOptional(Serializable id)

Same semantic as load except that here Optional is returned to handle nullability.

Parameters
id:Serializable

The identifier

Returns:Optional<T>

The persistent instance, if one, wrapped in Optional

withback to summary
public IdentifierLoadAccess<T> with(LockOptions lockOptions)

Specify the LockOptions to use when retrieving the entity.

Parameters
lockOptions:LockOptions

The lock options to use.

Returns:IdentifierLoadAccess<T>

this, for method chaining

withback to summary
public IdentifierLoadAccess<T> with(CacheMode cacheMode)

Specify the CacheMode to use when retrieving the entity.

Parameters
cacheMode:CacheMode

The CacheMode to use.

Returns:IdentifierLoadAccess<T>

this, for method chaining

withback to summary
public default IdentifierLoadAccess<T> with(RootGraph<T> graph)
withback to summary
public IdentifierLoadAccess<T> with(RootGraph<T> graph, GraphSemantic semantic)