org.hibernate
Interface IdentifierLoadAccess


public interface IdentifierLoadAccess

Loads an entity by its primary identifier


Method Summary
 Object getReference(Serializable id)
          Return the persistent instance with the given identifier, assuming that the instance exists.
 Object load(Serializable id)
          Return the persistent instance with the given identifier, or null if there is no such persistent instance.
 IdentifierLoadAccess with(LockOptions lockOptions)
          Specify the LockOptions to use when retrieving the entity.
 

Method Detail

with

IdentifierLoadAccess with(LockOptions lockOptions)
Specify the LockOptions to use when retrieving the entity.

Parameters:
lockOptions - The lock options to use.
Returns:
this, for method chaining

getReference

Object 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(java.io.Serializable) instead. Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.

Parameters:
id - The identifier for which to obtain a reference
Returns:
the persistent instance or proxy

load

Object 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 - The identifier
Returns:
The persistent instance or null


Copyright © 2001-2015 Red Hat, Inc. All Rights Reserved.