|
EclipseLink1.0 - 20080707 API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.descriptors.VersionLockingPolicy org.eclipse.persistence.descriptors.TimestampLockingPolicy
public class TimestampLockingPolicy
Purpose: Used to allow a single version timestamp to be used for optimistic locking.
Field Summary | |
---|---|
static int |
LOCAL_TIME
|
protected int |
retrieveTimeFrom
|
static int |
SERVER_TIME
|
Fields inherited from class org.eclipse.persistence.descriptors.VersionLockingPolicy |
---|
cachedExpression, descriptor, IN_CACHE, IN_OBJECT, isCascaded, lockMapping, lockValueStored, writeLockField |
Constructor Summary | |
---|---|
TimestampLockingPolicy()
PUBLIC: Create a new TimestampLockingPolicy. |
|
TimestampLockingPolicy(org.eclipse.persistence.internal.helper.DatabaseField field)
INTERNAL: Create a new TimestampLockingPolicy. |
|
TimestampLockingPolicy(java.lang.String fieldName)
PUBLIC: Create a new TimestampLockingPolicy. |
Method Summary | |
---|---|
int |
compareWriteLockValues(java.lang.Object value1,
java.lang.Object value2)
INTERNAL: This method compares two writeLockValues. |
java.lang.Object |
getBaseValue()
INTERNAL: This is the base value that is older than all other values, it is used in the place of null in some situations. |
protected java.lang.Class |
getDefaultLockingFieldType()
INTERNAL: Return the default timestamp locking filed java type, default is Timestamp. |
protected java.lang.Object |
getInitialWriteValue(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: returns the initial locking value |
java.lang.Object |
getNewLockValue(ModifyQuery query)
INTERNAL: Returns the new Timestamp value. |
java.lang.Object |
getValueToPutInCache(org.eclipse.persistence.internal.sessions.AbstractRecord row,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Return the value that should be stored in the identity map. |
int |
getVersionDifference(java.lang.Object currentValue,
java.lang.Object domainObject,
java.util.Vector primaryKeys,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Return the number of versions different between these objects. |
Expression |
getWriteLockUpdateExpression(ExpressionBuilder builder)
INTERNAL: Return an expression that updates the write lock |
java.lang.Object |
getWriteLockValue(java.lang.Object domainObject,
java.util.Vector primaryKey,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: This method will return the optimistic lock value for the object |
protected java.lang.Number |
incrementWriteLockValue(java.lang.Number numberValue)
INTERNAL: Timestamp versioning should not be able to do this. |
boolean |
isChildWriteLockValueGreater(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.util.Vector primaryKey,
java.lang.Class original,
org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet)
INTERNAL: Update the parent write lock value if the objectChangeSet's is greater. |
boolean |
isNewerVersion(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
java.lang.Object domainObject,
java.util.Vector primaryKey,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Compares the value from the row and from the object (or cache). |
boolean |
isNewerVersion(java.lang.Object currentValue,
java.lang.Object domainObject,
java.util.Vector primaryKey,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Compares the value with the value from the object (or cache). |
void |
setUsesServerTime(boolean usesServerTime)
PUBLIC: Set if policy uses server time. |
void |
useLocalTime()
PUBLIC: set this policy to get the time from the local machine. |
void |
useServerTime()
PUBLIC: set this policy to get the time from the server. |
boolean |
usesLocalTime()
PUBLIC: Return true if policy uses local time. |
boolean |
usesServerTime()
PUBLIC: Return true if policy uses server time. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int retrieveTimeFrom
public static final int SERVER_TIME
public static final int LOCAL_TIME
Constructor Detail |
---|
public TimestampLockingPolicy()
public TimestampLockingPolicy(java.lang.String fieldName)
fieldName
- the field where the write lock value will be stored.public TimestampLockingPolicy(org.eclipse.persistence.internal.helper.DatabaseField field)
field
- the field where the write lock value will be stored.Method Detail |
---|
public int compareWriteLockValues(java.lang.Object value1, java.lang.Object value2)
compareWriteLockValues
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
compareWriteLockValues
in class VersionLockingPolicy
protected java.lang.Class getDefaultLockingFieldType()
getDefaultLockingFieldType
in class VersionLockingPolicy
public java.lang.Object getBaseValue()
getBaseValue
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
getBaseValue
in class VersionLockingPolicy
protected java.lang.Object getInitialWriteValue(org.eclipse.persistence.internal.sessions.AbstractSession session)
getInitialWriteValue
in class VersionLockingPolicy
public java.lang.Object getNewLockValue(ModifyQuery query)
getNewLockValue
in class VersionLockingPolicy
public java.lang.Object getValueToPutInCache(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
getValueToPutInCache
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
getValueToPutInCache
in class VersionLockingPolicy
public int getVersionDifference(java.lang.Object currentValue, java.lang.Object domainObject, java.util.Vector primaryKeys, org.eclipse.persistence.internal.sessions.AbstractSession session)
getVersionDifference
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
getVersionDifference
in class VersionLockingPolicy
currentValue
- the new lock valuedomainObject
- the object containing the version to be compared toprimaryKeys
- a vector containing the primary keys of the domainObjectsession
- the session to be used with the comparisonpublic java.lang.Object getWriteLockValue(java.lang.Object domainObject, java.util.Vector primaryKey, org.eclipse.persistence.internal.sessions.AbstractSession session)
getWriteLockValue
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
getWriteLockValue
in class VersionLockingPolicy
public Expression getWriteLockUpdateExpression(ExpressionBuilder builder)
getWriteLockUpdateExpression
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
getWriteLockUpdateExpression
in class VersionLockingPolicy
protected java.lang.Number incrementWriteLockValue(java.lang.Number numberValue)
incrementWriteLockValue
in class VersionLockingPolicy
public boolean isChildWriteLockValueGreater(org.eclipse.persistence.internal.sessions.AbstractSession session, java.util.Vector primaryKey, java.lang.Class original, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet)
isChildWriteLockValueGreater
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
isChildWriteLockValueGreater
in class VersionLockingPolicy
public boolean isNewerVersion(java.lang.Object currentValue, java.lang.Object domainObject, java.util.Vector primaryKey, org.eclipse.persistence.internal.sessions.AbstractSession session)
isNewerVersion
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
isNewerVersion
in class VersionLockingPolicy
public boolean isNewerVersion(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, java.lang.Object domainObject, java.util.Vector primaryKey, org.eclipse.persistence.internal.sessions.AbstractSession session)
isNewerVersion
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
isNewerVersion
in class VersionLockingPolicy
public void setUsesServerTime(boolean usesServerTime)
public void useLocalTime()
public void useServerTime()
public boolean usesLocalTime()
public boolean usesServerTime()
|
EclipseLink1.0 - 20080707 API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |