This method is similar to {@link #fetch} except that it will load the objectonly once within a transaction and always return the same instance.
If the object is loaded for read-only then no lock is acquired and updates to the object are not reflected at commit time. If the object is loaded for read-write then a read lock is acquired (unless timeout or deadlock detected) and the object is stored at commit time. The object is then considered persistent and may be deleted or upgraded to write lock. If the object is loaded for exclusive access then a write lock is acquired and the object is synchronized with the persistent copy.
Attempting to load the object twice in the same transaction, once with exclusive lock and once with read-write lock will result in an exception. @param identity The object's identity. @param proposedObject The object to fetch (single instance per transaction). @param suggestedAccessMode The access mode (see {@link AccessMode}) the values in persistent storage. @return object being loaded. @throws PersistenceException Timeout or deadlock occured attempting to acquirelock on object. The object was not found in persistent storage. An error reported by the persistence engine.
|
|