public class CMPPolicy
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Description: Place holder for CMP specific information. This class can be set on the ClassDescriptor.
PessimisticLockingPolicy
,
Serialized FormModifier and Type | Class and Description |
---|---|
protected static interface |
CMPPolicy.KeyElementAccessor
INTERNAL:
This is the interface used to encapsulate the the type of key class element
|
protected static class |
CMPPolicy.KeyIsElementAccessor
INTERNAL:
This class will be used when the keyClass is a primitive
|
Modifier and Type | Field and Description |
---|---|
static int |
AFTER_EJBCREATE
issue SQL after ejbCreate but before ejbPostCreate
|
static int |
AFTER_EJBPOSTCREATE
issue SQL after ejbPostCreate
|
static int |
ALL_MODIFICATIONS
defer all modifications, inserts and deletes included (default)
|
protected ClassDescriptor |
descriptor |
protected java.lang.Boolean |
forceUpdate |
protected java.lang.Class |
mappedClass
Class originally mapped, before anything was generated.
|
protected int |
modificationDeferralLevel
The object deferral level.
|
protected int |
nonDeferredCreateTime
This setting will allow customers to control when Toplink will issue the insert SQL for CMP beans.
|
static int |
NONE
defer no changes
|
protected PessimisticLockingPolicy |
pessimisticLockingPolicy
Allow the bean to always be locked as it enters a new transaction.
|
static int |
UNDEFINED
undefined if it is non-deferred issue sql at create
|
static int |
UPDATE_MODIFICATIONS
defer updates
|
protected java.lang.Boolean |
updateAllFields |
Constructor and Description |
---|
CMPPolicy() |
Modifier and Type | Method and Description |
---|---|
CMPPolicy |
clone()
INTERNAL:
Clone the CMPPolicy
|
void |
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL:
Convert all the class-name-based settings in this object to actual class-based
settings.
|
java.lang.Object |
createBeanUsingKey(java.lang.Object key,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Use the key to create a bean and initialize its primary key fields.
|
java.lang.Object |
createPrimaryKeyFromId(java.lang.Object key,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Use the key to create a EclipseLink primary key.
|
java.lang.Object |
createPrimaryKeyInstance(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Create an instance of the Id class or value from the object.
|
java.lang.Object |
createPrimaryKeyInstanceFromId(java.lang.Object key,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Create an instance of the composite primary key class for the key object.
|
java.lang.Object |
createPrimaryKeyInstanceFromPrimaryKeyValues(org.eclipse.persistence.internal.sessions.AbstractSession session,
int[] elementIndex,
java.lang.Object... keyElements)
INTERNAL:
Create an instance of the composite primary key class for the key object.
|
java.lang.Object |
getClassInstance(java.lang.Class cls)
INTERNAL:
Return a new instance of the class provided.
|
int |
getDeferModificationsUntilCommit()
ADVANCED:
This can be used to control when changes to objects are submitted to the database
This is only applicable to TopLink's CMP implementation and not available within
the core.
|
ClassDescriptor |
getDescriptor()
INTERNAL:
|
boolean |
getForceUpdate()
ADVANCED:
Return true if descriptor is set to always update all registered objects of this type
|
protected CMPPolicy.KeyElementAccessor[] |
getKeyClassFields()
INTERNAL:
|
java.lang.Class |
getMappedClass()
PUBLIC:
Answer the mapped class.
|
int |
getNonDeferredCreateTime()
ADVANCED:
This setting is only available for CMP beans that are not being deferred.
|
PessimisticLockingPolicy |
getPessimisticLockingPolicy()
PUBLIC:
Return the policy for bean pessimistic locking
|
java.lang.Class |
getPKClass()
INTERNAL:
|
java.lang.Object |
getPKClassInstance()
INTERNAL:
|
boolean |
getUpdateAllFields()
ADVANCED:
Return true if descriptor is set to update all fields for an object of this
type when an update occurs.
|
boolean |
hasPessimisticLockingPolicy()
PUBLIC:
Return true if bean pessimistic locking is configured
|
void |
initialize(ClassDescriptor descriptor,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Initialize the CMPPolicy settings.
|
java.lang.Boolean |
internalGetForceUpdate()
INTERNAL:
return internal tri-state value so we can decide whether to inherit or not at init time.
|
java.lang.Boolean |
internalGetUpdateAllFields()
INTERNAL:
return internal tri-state value so we can decide whether to inherit or not at init time.
|
void |
internalSetForceUpdate(java.lang.Boolean newForceUpdateValue)
INTERNAL:
internal method to set the tri-state value.
|
void |
internalSetUpdateAllFields(java.lang.Boolean newUpdateAllFieldsValue)
INTERNAL:
internal method to set the tri-state value.
|
boolean |
isCMP3Policy()
INTERNAL:
Return if this policy is for CMP3.
|
protected boolean |
isSingleKey(CMPPolicy.KeyElementAccessor[] pkElementArray)
Check to see if there is a single key element.
|
void |
remoteInitialize(ClassDescriptor descriptor,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Initialize the CMPPolicy settings for remote sessions.
|
void |
setDeferModificationsUntilCommit(int deferralLevel)
ADVANCED:
This can be set to control when changes to objects are submitted to the database
This is only applicable to TopLink's CMP implementation and not available within
the core.
|
void |
setDescriptor(ClassDescriptor owningDescriptor)
INTERNAL:
|
protected void |
setFieldValue(CMPPolicy.KeyElementAccessor accessor,
java.lang.Object keyInstance,
DatabaseMapping mapping,
org.eclipse.persistence.internal.sessions.AbstractSession session,
int[] elementIndex,
java.lang.Object... keyElements)
INTERNAL:
Recursive method to set a field value in the given key instance.
|
void |
setForceUpdate(boolean shouldForceUpdate)
ADVANCED:
Configure whether TopLink should always update all registered objects of
this type.
|
void |
setMappedClass(java.lang.Class newMappedClass)
PUBLIC:
Define the mapped class.
|
void |
setNonDeferredCreateTime(int createTime)
ADVANCED:
This setting is only available for CMP beans that are not being deferred.
|
void |
setPessimisticLockingPolicy(PessimisticLockingPolicy policy)
PUBLIC:
Configure bean pessimistic locking
|
void |
setUpdateAllFields(boolean shouldUpdatAllFields)
ADVANCED:
Configure whether TopLink should update all fields for an object of this
type when an update occurs.
|
protected java.lang.Boolean forceUpdate
protected java.lang.Boolean updateAllFields
protected PessimisticLockingPolicy pessimisticLockingPolicy
protected java.lang.Class mappedClass
protected ClassDescriptor descriptor
protected int modificationDeferralLevel
public static final int NONE
public static final int UPDATE_MODIFICATIONS
public static final int ALL_MODIFICATIONS
protected int nonDeferredCreateTime
public static final int UNDEFINED
public static final int AFTER_EJBCREATE
public static final int AFTER_EJBPOSTCREATE
public int getNonDeferredCreateTime()
public PessimisticLockingPolicy getPessimisticLockingPolicy()
PessimisticLockingPolicy
public void setDeferModificationsUntilCommit(int deferralLevel)
public void setMappedClass(java.lang.Class newMappedClass)
newMappedClass
- public java.lang.Class getMappedClass()
public void setNonDeferredCreateTime(int createTime)
public void setPessimisticLockingPolicy(PessimisticLockingPolicy policy)
policy
- PessimisticLockingPolicy
public boolean hasPessimisticLockingPolicy()
public int getDeferModificationsUntilCommit()
public boolean getForceUpdate()
public void setForceUpdate(boolean shouldForceUpdate)
shouldForceUpdate
- public boolean getUpdateAllFields()
public void setUpdateAllFields(boolean shouldUpdatAllFields)
shouldUpdatAllFields
- public java.lang.Boolean internalGetForceUpdate()
public java.lang.Boolean internalGetUpdateAllFields()
public void internalSetForceUpdate(java.lang.Boolean newForceUpdateValue)
public void internalSetUpdateAllFields(java.lang.Boolean newUpdateAllFieldsValue)
public void initialize(ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
DescriptorException
public void remoteInitialize(ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
DescriptorException
public ClassDescriptor getDescriptor()
public void setDescriptor(ClassDescriptor owningDescriptor)
owningDescriptor
- The owningDescriptor to set.protected void setFieldValue(CMPPolicy.KeyElementAccessor accessor, java.lang.Object keyInstance, DatabaseMapping mapping, org.eclipse.persistence.internal.sessions.AbstractSession session, int[] elementIndex, java.lang.Object... keyElements)
public boolean isCMP3Policy()
public CMPPolicy clone()
clone
in class java.lang.Object
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
classLoader
- public java.lang.Object createPrimaryKeyInstanceFromId(java.lang.Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
public java.lang.Object createPrimaryKeyInstanceFromPrimaryKeyValues(org.eclipse.persistence.internal.sessions.AbstractSession session, int[] elementIndex, java.lang.Object... keyElements)
public java.lang.Object createPrimaryKeyInstance(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
public java.lang.Object getClassInstance(java.lang.Class cls)
public java.lang.Object getPKClassInstance()
public java.lang.Class getPKClass()
public java.lang.Object createPrimaryKeyFromId(java.lang.Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
public java.lang.Object createBeanUsingKey(java.lang.Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
key
- Object the primary key to use for initializing the bean's
corresponding pk fieldsprotected CMPPolicy.KeyElementAccessor[] getKeyClassFields()
protected boolean isSingleKey(CMPPolicy.KeyElementAccessor[] pkElementArray)
pkElementArray
-