org.apache.openjpa.kernel
Class VersionAttachStrategy

java.lang.Object
  extended by org.apache.openjpa.kernel.TransferFieldManager
      extended by org.apache.openjpa.kernel.AttachStrategy
          extended by org.apache.openjpa.kernel.VersionAttachStrategy
All Implemented Interfaces:
FieldConsumer, FieldManager, FieldSupplier, DetachState

 class VersionAttachStrategy
extends AttachStrategy
implements DetachState

Handles attaching instances using version and primary key fields.

Author:
Steve Kim

Field Summary
 
Fields inherited from class org.apache.openjpa.kernel.TransferFieldManager
dblval, field, longval, objval
 
Fields inherited from interface org.apache.openjpa.kernel.DetachState
DETACH_ALL, DETACH_FETCH_GROUPS, DETACH_FGS, DETACH_LOADED
 
Constructor Summary
VersionAttachStrategy()
           
 
Method Summary
 Object attach(AttachManager manager, Object toAttach, ClassMetaData meta, PersistenceCapable into, OpenJPAStateManager owner, ValueMetaData ownerMeta, boolean explicit)
          Attach.
protected  PersistenceCapable findFromDatabase(AttachManager manager, Object pc)
          Find a PersistenceCapable instance of an Object if it exists in the database.
protected  Object getDetachedObjectId(AttachManager manager, Object toAttach)
          Return the identity of the given detached instance.
protected  void provideField(Object toAttach, StateManagerImpl sm, int field)
          Provide the given field into this field manager.
 
Methods inherited from class org.apache.openjpa.kernel.AttachStrategy
attachCollection, attachField, attachMap, getReference, persist
 
Methods inherited from class org.apache.openjpa.kernel.TransferFieldManager
clear, fetchBooleanField, fetchByteField, fetchCharField, fetchDoubleField, fetchFloatField, fetchIntField, fetchLongField, fetchObjectField, fetchShortField, fetchStringField, storeBooleanField, storeByteField, storeCharField, storeDoubleField, storeFloatField, storeIntField, storeLongField, storeObjectField, storeShortField, storeStringField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionAttachStrategy

VersionAttachStrategy()
Method Detail

getDetachedObjectId

protected Object getDetachedObjectId(AttachManager manager,
                                     Object toAttach)
Description copied from class: AttachStrategy
Return the identity of the given detached instance.

Specified by:
getDetachedObjectId in class AttachStrategy

provideField

protected void provideField(Object toAttach,
                            StateManagerImpl sm,
                            int field)
Description copied from class: AttachStrategy
Provide the given field into this field manager.

Specified by:
provideField in class AttachStrategy

attach

public Object attach(AttachManager manager,
                     Object toAttach,
                     ClassMetaData meta,
                     PersistenceCapable into,
                     OpenJPAStateManager owner,
                     ValueMetaData ownerMeta,
                     boolean explicit)
Description copied from class: AttachStrategy
Attach.

Specified by:
attach in class AttachStrategy
Parameters:
manager - manager holding cache of attached instances
toAttach - detached instance
meta - metadata for the instance being attached
into - instance we're attaching into
owner - state manager for into
ownerMeta - field we traversed to find toAttach
explicit - whether to make new instances explicitly persistent

findFromDatabase

protected PersistenceCapable findFromDatabase(AttachManager manager,
                                              Object pc)
Find a PersistenceCapable instance of an Object if it exists in the database. If the object is null or can't be found in the database.

Parameters:
pc - An object which will be attached into the current context. The object may or may not correspond to a row in the database.
Returns:
If the object is null or can't be found in the database this method returns null. Otherwise a PersistenceCapable representation of the object is returned.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.