Top Description Inners Fields Constructors Methods
org.eclipse.persistence.descriptors

public Class CMPPolicy

extends Object
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Imports
java.io.Serializable, java.util.HashSet, .List, .Set, org.eclipse.persistence.annotations.CacheKeyType, org.eclipse.persistence.exceptions.DescriptorException, .ValidationException, org.eclipse.persistence.internal.descriptors.ObjectBuilder, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.identitymaps.CacheId, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.mappings.DatabaseMapping, .ObjectReferenceMapping, org.eclipse.persistence.mappings.converters.Converter, org.eclipse.persistence.mappings.foundation.AbstractColumnMapping, org.eclipse.persistence.queries.UpdateObjectQuery

Description: Place holder for CMP specific information. This class can be set on the ClassDescriptor.

Since
TopLink 10.1.3
See Also
org.eclipse.persistence.descriptors.PessimisticLockingPolicy

Nested and Inner Type Summary

Modifier and TypeClass 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

Field Summary

Modifier and TypeField and Description
public static final int
AFTER_EJBCREATE

issue SQL after ejbCreate but before ejbPostCreate

public static final int
AFTER_EJBPOSTCREATE

issue SQL after ejbPostCreate

public static final int
ALL_MODIFICATIONS

defer all modifications, inserts and deletes included (default)

protected ClassDescriptor
protected Boolean
protected 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.

public static final int
NONE

defer no changes

protected PessimisticLockingPolicy
pessimisticLockingPolicy

Allow the bean to always be locked as it enters a new transaction.

public static final int
UNDEFINED

undefined if it is non-deferred issue sql at create

public static final int
UPDATE_MODIFICATIONS

defer updates

protected Boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public CMPPolicy
clone()

Overrides java.lang.Object.clone.

INTERNAL: Clone the CMPPolicy
public void
convertClassNamesToClasses(ClassLoader classLoader)

INTERNAL: Convert all the class-name-based settings in this object to actual class-based settings.

public Object

Returns:

Object
createBeanUsingKey
(Object
Object the primary key to use for initializing the bean's corresponding pk fields
key
,
AbstractSession session)

INTERNAL: Use the key to create a bean and initialize its primary key fields.

public Object
createPrimaryKeyFromId(Object key, AbstractSession session)

INTERNAL: Use the key to create a EclipseLink primary key.

public Object
createPrimaryKeyInstance(Object object, AbstractSession session)

INTERNAL: Create an instance of the Id class or value from the object.

public Object
createPrimaryKeyInstanceFromId(Object key, AbstractSession session)

INTERNAL: Create an instance of the composite primary key class for the key object.

public Object
createPrimaryKeyInstanceFromPrimaryKeyValues(AbstractSession session, int[] elementIndex, Object... keyElements)

INTERNAL: Create an instance of the composite primary key class for the key object.

public Object
getClassInstance(Class<?> cls)

INTERNAL: Return a new instance of the class provided.

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.

public ClassDescriptor

Returns:

Returns the owningDescriptor.
getDescriptor
()

INTERNAL:

public boolean
getForceUpdate()

ADVANCED: Return true if descriptor is set to always update all registered objects of this type

protected CMPPolicy.KeyElementAccessor[]

Returns:

Returns the keyClassFields.
getKeyClassFields
()

INTERNAL:

public Class<?>
getMappedClass()

PUBLIC: Answer the mapped class.

public int
getNonDeferredCreateTime()

ADVANCED: This setting is only available for CMP beans that are not being deferred.

public PessimisticLockingPolicy
getPessimisticLockingPolicy()

PUBLIC: Return the policy for bean pessimistic locking

public <T> Class<T>
getPKClass()

INTERNAL:

public <T> T
getPKClassInstance()

INTERNAL:

public boolean
getUpdateAllFields()

ADVANCED: Return true if descriptor is set to update all fields for an object of this type when an update occurs.

public boolean
hasPessimisticLockingPolicy()

PUBLIC: Return true if bean pessimistic locking is configured

public void
initialize(ClassDescriptor descriptor, AbstractSession session)

INTERNAL: Initialize the CMPPolicy settings.

public Boolean
internalGetForceUpdate()

INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.

public Boolean
internalGetUpdateAllFields()

INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.

public void
internalSetForceUpdate(Boolean newForceUpdateValue)

INTERNAL: internal method to set the tri-state value.

public void
internalSetUpdateAllFields(Boolean newUpdateAllFieldsValue)

INTERNAL: internal method to set the tri-state value.

public 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.

public void
remoteInitialize(ClassDescriptor descriptor, AbstractSession session)

INTERNAL: Initialize the CMPPolicy settings for remote sessions.

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.

public void
setDescriptor(ClassDescriptor
The owningDescriptor to set.
owningDescriptor
)

INTERNAL:

protected void
setFieldValue(CMPPolicy.KeyElementAccessor accessor, Object keyInstance, DatabaseMapping mapping, AbstractSession session, int[] elementIndex, Object... keyElements)

INTERNAL: Recursive method to set a field value in the given key instance.

public void
setForceUpdate(boolean shouldForceUpdate)

ADVANCED: Configure whether TopLink should always update all registered objects of this type.

public void
setMappedClass(Class<?> newMappedClass)

PUBLIC: Define the mapped class.

public void
setNonDeferredCreateTime(int createTime)

ADVANCED: This setting is only available for CMP beans that are not being deferred.

public void
setPessimisticLockingPolicy(PessimisticLockingPolicy policy)

PUBLIC: Configure bean pessimistic locking

public void
setUpdateAllFields(boolean shouldUpdatAllFields)

ADVANCED: Configure whether TopLink should update all fields for an object of this type when an update occurs.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

AFTER_EJBCREATEback to summary
public static final int AFTER_EJBCREATE

issue SQL after ejbCreate but before ejbPostCreate

AFTER_EJBPOSTCREATEback to summary
public static final int AFTER_EJBPOSTCREATE

issue SQL after ejbPostCreate

ALL_MODIFICATIONSback to summary
public static final int ALL_MODIFICATIONS

defer all modifications, inserts and deletes included (default)

descriptorback to summary
protected ClassDescriptor descriptor
forceUpdateback to summary
protected Boolean forceUpdate
mappedClassback to summary
protected Class<?> mappedClass

Class originally mapped, before anything was generated.

modificationDeferralLevelback to summary
protected int modificationDeferralLevel

The object deferral level. This controls when objects changes will be sent to the Database.

nonDeferredCreateTimeback to summary
protected int nonDeferredCreateTime

This setting will allow customers to control when Toplink will issue the insert SQL for CMP beans.

NONEback to summary
public static final int NONE

defer no changes

pessimisticLockingPolicyback to summary
protected PessimisticLockingPolicy pessimisticLockingPolicy

Allow the bean to always be locked as it enters a new transaction.

UNDEFINEDback to summary
public static final int UNDEFINED

undefined if it is non-deferred issue sql at create

UPDATE_MODIFICATIONSback to summary
public static final int UPDATE_MODIFICATIONS

defer updates

updateAllFieldsback to summary
protected Boolean updateAllFields

Constructor Detail

CMPPolicyback to summary
public CMPPolicy()

Method Detail

cloneback to summary
public CMPPolicy clone()

Overrides java.lang.Object.clone.

INTERNAL: Clone the CMPPolicy

Returns:CMPPolicy

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
convertClassNamesToClassesback to summary
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.

createBeanUsingKeyback to summary
public Object createBeanUsingKey(Object key, 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

Object the primary key to use for initializing the bean's corresponding pk fields

Returns:Object

Object

createPrimaryKeyFromIdback to summary
public Object createPrimaryKeyFromId(Object key, 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.

createPrimaryKeyInstanceback to summary
public Object createPrimaryKeyInstance(Object object, AbstractSession session)

INTERNAL: Create an instance of the Id class or value from the object.

createPrimaryKeyInstanceFromIdback to summary
public Object createPrimaryKeyInstanceFromId(Object key, AbstractSession session)

INTERNAL: Create an instance of the composite primary key class for the key object.

createPrimaryKeyInstanceFromPrimaryKeyValuesback to summary
public Object createPrimaryKeyInstanceFromPrimaryKeyValues(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

getClassInstanceback to summary
public Object getClassInstance(Class<?> cls)

INTERNAL: Return a new instance of the class provided.

getDeferModificationsUntilCommitback to summary
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.

getDescriptorback to summary
public ClassDescriptor getDescriptor()

INTERNAL:

Returns:ClassDescriptor

Returns the owningDescriptor.

getForceUpdateback to summary
public boolean getForceUpdate()

ADVANCED: Return true if descriptor is set to always update all registered objects of this type

getKeyClassFieldsback to summary
protected CMPPolicy.KeyElementAccessor[] getKeyClassFields()

INTERNAL:

Returns:CMPPolicy.KeyElementAccessor[]

Returns the keyClassFields.

getMappedClassback to summary
public Class<?> getMappedClass()

PUBLIC: Answer the mapped class. This is the class which was originally mapped in the MW

getNonDeferredCreateTimeback to summary
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.

getPessimisticLockingPolicyback to summary
public PessimisticLockingPolicy getPessimisticLockingPolicy()

PUBLIC: Return the policy for bean pessimistic locking

See Also
org.eclipse.persistence.descriptors.PessimisticLockingPolicy
getPKClassback to summary
public <T> Class<T> getPKClass()

INTERNAL:

getPKClassInstanceback to summary
public <T> T getPKClassInstance()

INTERNAL:

getUpdateAllFieldsback to summary
public boolean getUpdateAllFields()

ADVANCED: Return true if descriptor is set to update all fields for an object of this type when an update occurs.

hasPessimisticLockingPolicyback to summary
public boolean hasPessimisticLockingPolicy()

PUBLIC: Return true if bean pessimistic locking is configured

initializeback to summary
public void initialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException

INTERNAL: Initialize the CMPPolicy settings.

internalGetForceUpdateback to summary
public Boolean internalGetForceUpdate()

INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.

internalGetUpdateAllFieldsback to summary
public Boolean internalGetUpdateAllFields()

INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.

internalSetForceUpdateback to summary
public void internalSetForceUpdate(Boolean newForceUpdateValue)

INTERNAL: internal method to set the tri-state value. This is done in InheritancePolicy at init time.

internalSetUpdateAllFieldsback to summary
public void internalSetUpdateAllFields(Boolean newUpdateAllFieldsValue)

INTERNAL: internal method to set the tri-state value. This is done in InheritancePolicy at init time.

isCMP3Policyback to summary
public boolean isCMP3Policy()

INTERNAL: Return if this policy is for CMP3.

isSingleKeyback to summary
protected boolean isSingleKey(CMPPolicy.KeyElementAccessor[] pkElementArray)

Check to see if there is a single key element. Iterate through the list of primary key elements and count only keys that are not part of the Multitenant identifier.

remoteInitializeback to summary
public void remoteInitialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException

INTERNAL: Initialize the CMPPolicy settings for remote sessions.

setDeferModificationsUntilCommitback to summary
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.

setDescriptorback to summary
public void setDescriptor(ClassDescriptor owningDescriptor)

INTERNAL:

Parameters
owningDescriptor:ClassDescriptor

The owningDescriptor to set.

setFieldValueback to summary
protected void setFieldValue(CMPPolicy.KeyElementAccessor accessor, Object keyInstance, DatabaseMapping mapping, AbstractSession session, int[] elementIndex, Object... keyElements)

INTERNAL: Recursive method to set a field value in the given key instance.

setForceUpdateback to summary
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

setMappedClassback to summary
public void setMappedClass(Class<?> newMappedClass)

PUBLIC: Define the mapped class. This is the class which was originally mapped in the MW

setNonDeferredCreateTimeback to summary
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.

setPessimisticLockingPolicyback to summary
public void setPessimisticLockingPolicy(PessimisticLockingPolicy policy)

PUBLIC: Configure bean pessimistic locking

See Also
org.eclipse.persistence.descriptors.PessimisticLockingPolicy
setUpdateAllFieldsback to summary
public void setUpdateAllFields(boolean shouldUpdatAllFields)

ADVANCED: Configure whether TopLink should update all fields for an object of this type when an update occurs.

org.eclipse.persistence.descriptors back to summary

protected Interface CMPPolicy.KeyElementAccessor

Known Direct Implementers
org.eclipse.persistence.descriptors.CMPPolicy.KeyIsElementAccessor

INTERNAL: This is the interface used to encapsulate the the type of key class element

Method Summary

Modifier and TypeMethod and Description
public String
public DatabaseField
public DatabaseMapping
public Object
getValue(Object object, AbstractSession session)

public boolean
public void
setValue(Object object, Object value)

Method Detail

getAttributeNameback to summary
public String getAttributeName()
getDatabaseFieldback to summary
public DatabaseField getDatabaseField()
getMappingback to summary
public DatabaseMapping getMapping()
getValueback to summary
public Object getValue(Object object, AbstractSession session)
isNestedAccessorback to summary
public boolean isNestedAccessor()
setValueback to summary
public void setValue(Object object, Object value)
org.eclipse.persistence.descriptors back to summary

protected final Class CMPPolicy.KeyIsElementAccessor

extends Object
implements KeyElementAccessor, Serializable
Class Inheritance
  • java.lang.Object
  • org.eclipse.persistence.descriptors.CMPPolicy.KeyIsElementAccessor
All Implemented Interfaces
java.io.Serializable, org.eclipse.persistence.descriptors.CMPPolicy.KeyElementAccessor

INTERNAL: This class will be used when the keyClass is a primitive

Field Summary

Modifier and TypeField and Description
protected String
protected DatabaseField
protected DatabaseMapping

Constructor Summary

AccessConstructor and Description
public
KeyIsElementAccessor(String attributeName, DatabaseField databaseField, DatabaseMapping mapping)

Method Summary

Modifier and TypeMethod and Description
public String
public DatabaseField
public DatabaseMapping
public Object
public boolean
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeNameback to summary
protected String attributeName
databaseFieldback to summary
protected DatabaseField databaseField
mappingback to summary
protected DatabaseMapping mapping

Constructor Detail

KeyIsElementAccessorback to summary
public KeyIsElementAccessor(String attributeName, DatabaseField databaseField, DatabaseMapping mapping)

Method Detail

getAttributeNameback to summary
public String getAttributeName()

Implements org.eclipse.persistence.descriptors.CMPPolicy.KeyElementAccessor.getAttributeName.

Annotations
@Override
getDatabaseFieldback to summary
public DatabaseField getDatabaseField()

Implements org.eclipse.persistence.descriptors.CMPPolicy.KeyElementAccessor.getDatabaseField.

Annotations
@Override
getMappingback to summary
public DatabaseMapping getMapping()

Implements org.eclipse.persistence.descriptors.CMPPolicy.KeyElementAccessor.getMapping.

Annotations
@Override
getValueback to summary
public Object getValue(Object object, AbstractSession session)

Implements org.eclipse.persistence.descriptors.CMPPolicy.KeyElementAccessor.getValue.

Annotations
@Override
isNestedAccessorback to summary
public boolean isNestedAccessor()

Implements org.eclipse.persistence.descriptors.CMPPolicy.KeyElementAccessor.isNestedAccessor.

Annotations
@Override
setValueback to summary
public void setValue(Object object, Object value)

Implements org.eclipse.persistence.descriptors.CMPPolicy.KeyElementAccessor.setValue.

Annotations
@Override