Class CMPPolicy
- java.lang.Object
-
- org.eclipse.persistence.descriptors.CMPPolicy
-
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
org.eclipse.persistence.internal.jpa.CMP3Policy
public class CMPPolicy extends Object implements Serializable, Cloneable
Description: Place holder for CMP specific information. This class can be set on the ClassDescriptor.
- Since:
- TopLink 10.1.3
- See Also:
PessimisticLockingPolicy, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intAFTER_EJBCREATEissue SQL after ejbCreate but before ejbPostCreatestatic intAFTER_EJBPOSTCREATEissue SQL after ejbPostCreatestatic intALL_MODIFICATIONSdefer all modifications, inserts and deletes included (default)static intNONEdefer no changesstatic intUNDEFINEDundefined if it is non-deferred issue sql at createstatic intUPDATE_MODIFICATIONSdefer updates
-
Constructor Summary
Constructors Constructor Description CMPPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CMPPolicyclone()INTERNAL: Clone the CMPPolicyvoidconvertClassNamesToClasses(ClassLoader classLoader)INTERNAL: Convert all the class-name-based settings in this object to actual class-based settings.ObjectcreateBeanUsingKey(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Use the key to create a bean and initialize its primary key fields.ObjectcreatePrimaryKeyFromId(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Use the key to create a EclipseLink primary key.ObjectcreatePrimaryKeyInstance(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Create an instance of the Id class or value from the object.ObjectcreatePrimaryKeyInstanceFromId(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Create an instance of the composite primary key class for the key object.ObjectcreatePrimaryKeyInstanceFromPrimaryKeyValues(org.eclipse.persistence.internal.sessions.AbstractSession session, int[] elementIndex, Object... keyElements)INTERNAL: Create an instance of the composite primary key class for the key object.ObjectgetClassInstance(Class cls)INTERNAL: Return a new instance of the class provided.intgetDeferModificationsUntilCommit()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.ClassDescriptorgetDescriptor()INTERNAL:booleangetForceUpdate()ADVANCED: Return true if descriptor is set to always update all registered objects of this typeClassgetMappedClass()PUBLIC: Answer the mapped class.intgetNonDeferredCreateTime()ADVANCED: This setting is only available for CMP beans that are not being deferred.PessimisticLockingPolicygetPessimisticLockingPolicy()PUBLIC: Return the policy for bean pessimistic lockingClassgetPKClass()INTERNAL:ObjectgetPKClassInstance()INTERNAL:booleangetUpdateAllFields()ADVANCED: Return true if descriptor is set to update all fields for an object of this type when an update occurs.booleanhasPessimisticLockingPolicy()PUBLIC: Return true if bean pessimistic locking is configuredvoidinitialize(ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Initialize the CMPPolicy settings.BooleaninternalGetForceUpdate()INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.BooleaninternalGetUpdateAllFields()INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.voidinternalSetForceUpdate(Boolean newForceUpdateValue)INTERNAL: internal method to set the tri-state value.voidinternalSetUpdateAllFields(Boolean newUpdateAllFieldsValue)INTERNAL: internal method to set the tri-state value.booleanisCMP3Policy()INTERNAL: Return if this policy is for CMP3.voidremoteInitialize(ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Initialize the CMPPolicy settings for remote sessions.voidsetDeferModificationsUntilCommit(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.voidsetDescriptor(ClassDescriptor owningDescriptor)INTERNAL:voidsetForceUpdate(boolean shouldForceUpdate)ADVANCED: Configure whether TopLink should always update all registered objects of this type.voidsetMappedClass(Class newMappedClass)PUBLIC: Define the mapped class.voidsetNonDeferredCreateTime(int createTime)ADVANCED: This setting is only available for CMP beans that are not being deferred.voidsetPessimisticLockingPolicy(PessimisticLockingPolicy policy)PUBLIC: Configure bean pessimistic lockingvoidsetUpdateAllFields(boolean shouldUpdatAllFields)ADVANCED: Configure whether TopLink should update all fields for an object of this type when an update occurs.
-
-
-
Field Detail
-
NONE
public static final int NONE
defer no changes- See Also:
- Constant Field Values
-
UPDATE_MODIFICATIONS
public static final int UPDATE_MODIFICATIONS
defer updates- See Also:
- Constant Field Values
-
ALL_MODIFICATIONS
public static final int ALL_MODIFICATIONS
defer all modifications, inserts and deletes included (default)- See Also:
- Constant Field Values
-
UNDEFINED
public static final int UNDEFINED
undefined if it is non-deferred issue sql at create- See Also:
- Constant Field Values
-
AFTER_EJBCREATE
public static final int AFTER_EJBCREATE
issue SQL after ejbCreate but before ejbPostCreate- See Also:
- Constant Field Values
-
AFTER_EJBPOSTCREATE
public static final int AFTER_EJBPOSTCREATE
issue SQL after ejbPostCreate- See Also:
- Constant Field Values
-
-
Method Detail
-
getNonDeferredCreateTime
public int getNonDeferredCreateTime()
ADVANCED: This setting is only available for CMP beans that are not being deferred. Using it will allow TopLink to determine if the INSERT SQL should be sent to the database before or after the postCreate call.
-
getPessimisticLockingPolicy
public PessimisticLockingPolicy getPessimisticLockingPolicy()
PUBLIC: Return the policy for bean pessimistic locking- See Also:
PessimisticLockingPolicy
-
setDeferModificationsUntilCommit
public 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.
-
setMappedClass
public void setMappedClass(Class newMappedClass)
PUBLIC: Define the mapped class. This is the class which was originally mapped in the MW- Parameters:
newMappedClass-
-
getMappedClass
public Class getMappedClass()
PUBLIC: Answer the mapped class. This is the class which was originally mapped in the MW
-
setNonDeferredCreateTime
public void setNonDeferredCreateTime(int createTime)
ADVANCED: This setting is only available for CMP beans that are not being deferred. Using it will allow TopLink to determine if the INSERT SQL should be sent to the database before or after the postCreate call.
-
setPessimisticLockingPolicy
public void setPessimisticLockingPolicy(PessimisticLockingPolicy policy)
PUBLIC: Configure bean pessimistic locking- Parameters:
policy-- See Also:
PessimisticLockingPolicy
-
hasPessimisticLockingPolicy
public boolean hasPessimisticLockingPolicy()
PUBLIC: Return true if bean pessimistic locking is configured
-
getDeferModificationsUntilCommit
public 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.
-
getForceUpdate
public boolean getForceUpdate()
ADVANCED: Return true if descriptor is set to always update all registered objects of this type
-
setForceUpdate
public void setForceUpdate(boolean shouldForceUpdate)
ADVANCED: Configure whether TopLink should always update all registered objects of this type. NOTE: if set to true, then updateAllFields must also be set to true- Parameters:
shouldForceUpdate-
-
getUpdateAllFields
public boolean getUpdateAllFields()
ADVANCED: Return true if descriptor is set to update all fields for an object of this type when an update occurs.
-
setUpdateAllFields
public void setUpdateAllFields(boolean shouldUpdatAllFields)
ADVANCED: Configure whether TopLink should update all fields for an object of this type when an update occurs.- Parameters:
shouldUpdatAllFields-
-
internalGetForceUpdate
public Boolean internalGetForceUpdate()
INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.
-
internalGetUpdateAllFields
public Boolean internalGetUpdateAllFields()
INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.
-
internalSetForceUpdate
public void internalSetForceUpdate(Boolean newForceUpdateValue)
INTERNAL: internal method to set the tri-state value. This is done in InheritancePolicy at init time.
-
internalSetUpdateAllFields
public void internalSetUpdateAllFields(Boolean newUpdateAllFieldsValue)
INTERNAL: internal method to set the tri-state value. This is done in InheritancePolicy at init time.
-
initialize
public void initialize(ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: Initialize the CMPPolicy settings.- Throws:
DescriptorException
-
remoteInitialize
public void remoteInitialize(ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: Initialize the CMPPolicy settings for remote sessions.- Throws:
DescriptorException
-
getDescriptor
public ClassDescriptor getDescriptor()
INTERNAL:- Returns:
- Returns the owningDescriptor.
-
setDescriptor
public void setDescriptor(ClassDescriptor owningDescriptor)
INTERNAL:- Parameters:
owningDescriptor- The owningDescriptor to set.
-
isCMP3Policy
public boolean isCMP3Policy()
INTERNAL: Return if this policy is for CMP3.
-
clone
public CMPPolicy clone()
INTERNAL: Clone the CMPPolicy
-
convertClassNamesToClasses
public void convertClassNamesToClasses(ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this object to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.- Parameters:
classLoader-
-
createPrimaryKeyInstanceFromId
public Object createPrimaryKeyInstanceFromId(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Create an instance of the composite primary key class for the key object.
-
createPrimaryKeyInstanceFromPrimaryKeyValues
public Object createPrimaryKeyInstanceFromPrimaryKeyValues(org.eclipse.persistence.internal.sessions.AbstractSession session, int[] elementIndex, Object... keyElements)
INTERNAL: Create an instance of the composite primary key class for the key object. Yes the elementIndex looks strange but this is just a simple way to get the index to be pass-by-reference
-
createPrimaryKeyInstance
public Object createPrimaryKeyInstance(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Create an instance of the Id class or value from the object.
-
getClassInstance
public Object getClassInstance(Class cls)
INTERNAL: Return a new instance of the class provided.
-
getPKClassInstance
public Object getPKClassInstance()
INTERNAL:
-
getPKClass
public Class getPKClass()
INTERNAL:
-
createPrimaryKeyFromId
public Object createPrimaryKeyFromId(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Use the key to create a EclipseLink primary key. If the key is simple (direct mapped) then just add it to a vector, otherwise must go through the inefficient process of copying the key into the bean and extracting the key from the bean.
-
createBeanUsingKey
public Object createBeanUsingKey(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Use the key to create a bean and initialize its primary key fields. Note: If is a compound PK then a primary key object is being used. This method should only be used for 'templates' when executing queries. The bean built will not be given an EntityContext and should not be used as an actual entity bean.- Parameters:
key- Object the primary key to use for initializing the bean's corresponding pk fields- Returns:
- Object
-
-