Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.jpa

public Class CMP3Policy

extends CMPPolicy
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.dynamic.DynamicIdentityPolicy
Imports
java.lang.reflect.Field, .Method, java.security.AccessController, .PrivilegedActionException, java.util.ArrayList, .HashMap, .Iterator, .List, org.eclipse.persistence.annotations.CacheKeyType, org.eclipse.persistence.descriptors.CMPPolicy, .ClassDescriptor, org.eclipse.persistence.exceptions.DescriptorException, org.eclipse.persistence.internal.helper.ConversionManager, .DatabaseField, org.eclipse.persistence.internal.identitymaps.CacheId, org.eclipse.persistence.internal.indirection.WeavedObjectBasicIndirectionPolicy, org.eclipse.persistence.internal.localization.ExceptionLocalization, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, .PrivilegedClassForName, .PrivilegedGetField, .PrivilegedGetMethod, .PrivilegedGetValueFromField, .PrivilegedMethodInvoker, .PrivilegedSetValueInField, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.mappings.DatabaseMapping, .ObjectReferenceMapping, .OneToOneMapping, org.eclipse.persistence.mappings.foundation.AbstractColumnMapping

Defines primary key extraction code for use in JPA. A descriptor should have a CMP3Policy attached to handle basic Id as well as IdClass/EmbeddedId usage.
Since
TopLink 10.1.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
private static class
CMP3Policy.FieldAccessor

INTERNAL: This class will be used when the element of the keyclass is a field

private static class
CMP3Policy.PropertyAccessor

INTERNAL: This class is used when the key class element is a property

private static class
CMP3Policy.ValuesFieldAccessor

INTERNAL: This class will be used when the element of the keyclass is a virtual field.

Field Summary

Modifier and TypeField and Description
protected transient HashMap<DatabaseField, CMPPolicy.KeyElementAccessor>
fieldToAccessorMap

Used to look up the KeyElementAccessor for a specific DatabaseField, used for resolving DerivedIds

protected transient CMPPolicy.KeyElementAccessor[]
keyClassFields

Stores the fields for this classes compound primary key class if required.

protected Class<?>
protected String
Inherited from org.eclipse.persistence.descriptors.CMPPolicy:
AFTER_EJBCREATEAFTER_EJBPOSTCREATEALL_MODIFICATIONSdescriptorforceUpdatemappedClassmodificationDeferralLevelnonDeferredCreateTimeNONEpessimisticLockingPolicyUNDEFINEDUPDATE_MODIFICATIONSupdateAllFields

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
addReadOnlyMappings(ClassDescriptor aDescriptor, DatabaseField field, List<E> allMappings)

INTERNAL: Add the writable mapping for the given field to the allMappings list.

protected void
addWritableMapping(ClassDescriptor aDescriptor, DatabaseField field, List<E> allMappings)

INTERNAL: Add the read only mappings for the given field to the allMappings list.

public CMP3Policy
clone()

Overrides org.eclipse.persistence.descriptors.CMPPolicy.clone.

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

Overrides org.eclipse.persistence.descriptors.CMPPolicy.convertClassNamesToClasses.

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)

Overrides org.eclipse.persistence.descriptors.CMPPolicy.createBeanUsingKey.

INTERNAL: Use the key to create a bean and initialize its primary key fields.
public Object
createPrimaryKeyFromId(Object key, AbstractSession session)

Overrides org.eclipse.persistence.descriptors.CMPPolicy.createPrimaryKeyFromId.

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

Returns:

the field from the class with name equal to fieldName.
getField
(Class<?> cls, String fieldName)

INTERNAL:

protected CMPPolicy.KeyElementAccessor[]

Returns:

Returns the keyClassFields.
getKeyClassFields
()

Overrides org.eclipse.persistence.descriptors.CMPPolicy.getKeyClassFields.

INTERNAL:
public <T> Class<T>
getPKClass()

Overrides org.eclipse.persistence.descriptors.CMPPolicy.getPKClass.

INTERNAL: Return the java Class representing the primary key class name
public Object
public String
getPKClassName()

INTERNAL:

public Object

Returns:

Object
getPkValueFromKeyForField
(Object
Object the primary key to use to get the value for the field
key
,
DatabaseField
DatabaseField the field to find a value for
field
,
AbstractSession session)

INTERNAL: Pull the value for the field from the key.

public void
initialize(ClassDescriptor descriptor, AbstractSession session)

Overrides org.eclipse.persistence.descriptors.CMPPolicy.initialize.

INTERNAL: Initialize the CMPPolicy settings.
protected CMPPolicy.KeyElementAccessor[]
initializePrimaryKeyFields(Class<?> keyClass, AbstractSession session)

INTERNAL: Cache the bean's primary key fields so speed up creating of primary key objects and initialization of beans.

public boolean
isCMP3Policy()

Overrides org.eclipse.persistence.descriptors.CMPPolicy.isCMP3Policy.

INTERNAL: Return if this policy is for CMP3.
public void
remoteInitialize(ClassDescriptor descriptor, AbstractSession session)

Overrides org.eclipse.persistence.descriptors.CMPPolicy.remoteInitialize.

INTERNAL: Initialize the CMPPolicy settings for remote sessions.
public void
setPKClass(Class<?> pkClass)

ADVANCED:

public void
setPrimaryKeyClassName(String pkClassName)

INTERNAL:

Inherited from org.eclipse.persistence.descriptors.CMPPolicy:
createPrimaryKeyInstancecreatePrimaryKeyInstanceFromIdcreatePrimaryKeyInstanceFromPrimaryKeyValuesgetClassInstancegetDeferModificationsUntilCommitgetDescriptorgetForceUpdategetMappedClassgetNonDeferredCreateTimegetPessimisticLockingPolicygetUpdateAllFieldshasPessimisticLockingPolicyinternalGetForceUpdateinternalGetUpdateAllFieldsinternalSetForceUpdateinternalSetUpdateAllFieldsisSingleKeysetDeferModificationsUntilCommitsetDescriptorsetFieldValuesetForceUpdatesetMappedClasssetNonDeferredCreateTimesetPessimisticLockingPolicysetUpdateAllFields

Field Detail

fieldToAccessorMapback to summary
protected transient HashMap<DatabaseField, CMPPolicy.KeyElementAccessor> fieldToAccessorMap

Used to look up the KeyElementAccessor for a specific DatabaseField, used for resolving DerivedIds

keyClassFieldsback to summary
protected transient CMPPolicy.KeyElementAccessor[] keyClassFields

Stores the fields for this classes compound primary key class if required.

pkClassback to summary
protected Class<?> pkClass
pkClassNameback to summary
protected String pkClassName

Constructor Detail

CMP3Policyback to summary
public CMP3Policy()

Method Detail

addReadOnlyMappingsback to summary
protected void addReadOnlyMappings(ClassDescriptor aDescriptor, DatabaseField field, List<E> allMappings)

INTERNAL: Add the writable mapping for the given field to the allMappings list.

addWritableMappingback to summary
protected void addWritableMapping(ClassDescriptor aDescriptor, DatabaseField field, List<E> allMappings)

INTERNAL: Add the read only mappings for the given field to the allMappings list.

cloneback to summary
public CMP3Policy clone()

Overrides org.eclipse.persistence.descriptors.CMPPolicy.clone.

INTERNAL: Clone the CMP3Policy

Returns:CMP3Policy

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
convertClassNamesToClassesback to summary
public void convertClassNamesToClasses(ClassLoader classLoader)

Overrides org.eclipse.persistence.descriptors.CMPPolicy.convertClassNamesToClasses.

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.

Annotations
@Override
createBeanUsingKeyback to summary
public Object createBeanUsingKey(Object key, AbstractSession session)

Overrides org.eclipse.persistence.descriptors.CMPPolicy.createBeanUsingKey.

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

Annotations
@Override
createPrimaryKeyFromIdback to summary
public Object createPrimaryKeyFromId(Object key, AbstractSession session)

Overrides org.eclipse.persistence.descriptors.CMPPolicy.createPrimaryKeyFromId.

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.

Annotations
@Override
getFieldback to summary
protected Field getField(Class<?> cls, String fieldName) throws NoSuchFieldException

INTERNAL:

Returns:Field

the field from the class with name equal to fieldName.

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

Overrides org.eclipse.persistence.descriptors.CMPPolicy.getKeyClassFields.

INTERNAL:

Returns:CMPPolicy.KeyElementAccessor[]

Returns the keyClassFields.

Annotations
@Override
getPKClassback to summary
public <T> Class<T> getPKClass()

Overrides org.eclipse.persistence.descriptors.CMPPolicy.getPKClass.

INTERNAL: Return the java Class representing the primary key class name

Annotations
@Override
@SuppressWarnings:unchecked
getPKClassInstanceback to summary
public Object getPKClassInstance()

Overrides org.eclipse.persistence.descriptors.CMPPolicy.getPKClassInstance.

INTERNAL:

Annotations
@Override
getPKClassNameback to summary
public String getPKClassName()

INTERNAL:

getPkValueFromKeyForFieldback to summary
public Object getPkValueFromKeyForField(Object key, DatabaseField field, AbstractSession session)

INTERNAL: Pull the value for the field from the key.

Parameters
key:Object

Object the primary key to use to get the value for the field

field:DatabaseField

DatabaseField the field to find a value for

Returns:Object

Object

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

Overrides org.eclipse.persistence.descriptors.CMPPolicy.initialize.

INTERNAL: Initialize the CMPPolicy settings.

Annotations
@Override
initializePrimaryKeyFieldsback to summary
protected CMPPolicy.KeyElementAccessor[] initializePrimaryKeyFields(Class<?> keyClass, AbstractSession session)

INTERNAL: Cache the bean's primary key fields so speed up creating of primary key objects and initialization of beans. Note, we have to re-look up the fields for the bean class since these fields may have been loaded with the wrong loader (thank you Kirk). If the key is compound, we also have to look up the fields for the key.

isCMP3Policyback to summary
public boolean isCMP3Policy()

Overrides org.eclipse.persistence.descriptors.CMPPolicy.isCMP3Policy.

INTERNAL: Return if this policy is for CMP3.

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

Overrides org.eclipse.persistence.descriptors.CMPPolicy.remoteInitialize.

INTERNAL: Initialize the CMPPolicy settings for remote sessions.

Annotations
@Override
setPKClassback to summary
public void setPKClass(Class<?> pkClass)

ADVANCED:

setPrimaryKeyClassNameback to summary
public void setPrimaryKeyClassName(String pkClassName)

INTERNAL:

org.eclipse.persistence.internal.jpa back to summary

private abstract Class CMP3Policy.CommonAccessor

extends Object
implements KeyElementAccessor
Class Inheritance
  • java.lang.Object
  • org.eclipse.persistence.internal.jpa.CMP3Policy.CommonAccessor
All Implemented Interfaces
org.eclipse.persistence.descriptors.CMPPolicy.KeyElementAccessor
Known Direct Subclasses
org.eclipse.persistence.internal.jpa.CMP3Policy.PropertyAccessor, org.eclipse.persistence.internal.jpa.CMP3Policy.FieldAccessor, org.eclipse.persistence.internal.jpa.CMP3Policy.ValuesFieldAccessor

Field Summary

Modifier and TypeField and Description
private final String
private final DatabaseField
private final boolean
protected final DatabaseMapping

Constructor Summary

AccessConstructor and Description
public
CommonAccessor(String attributeName, DatabaseField field, DatabaseMapping mapping, boolean isNestedAccessor)

Method Summary

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

Field Detail

attributeNameback to summary
private final String attributeName
databaseFieldback to summary
private final DatabaseField databaseField
isNestedAccessorback to summary
private final boolean isNestedAccessor
mappingback to summary
protected final DatabaseMapping mapping

Constructor Detail

CommonAccessorback to summary
public CommonAccessor(String attributeName, DatabaseField field, DatabaseMapping mapping, boolean isNestedAccessor)

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
isNestedAccessorback to summary
public boolean isNestedAccessor()

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

Annotations
@Override
org.eclipse.persistence.internal.jpa back to summary

private final Class CMP3Policy.FieldAccessor

extends CommonAccessor
Class Inheritance

INTERNAL: This class will be used when the element of the keyclass is a field

Field Summary

Modifier and TypeField and Description
private final Field
private final CMPPolicy
Inherited from org.eclipse.persistence.internal.jpa.CMP3Policy.CommonAccessor:
mapping

Constructor Summary

AccessConstructor and Description
public
FieldAccessor(CMPPolicy policy, Field field, String attributeName, DatabaseField databaseField, DatabaseMapping mapping, boolean isNestedAccessor)

Method Summary

Modifier and TypeMethod and Description
public Object
public void
Inherited from org.eclipse.persistence.internal.jpa.CMP3Policy.CommonAccessor:
getAttributeNamegetDatabaseFieldgetMappingisNestedAccessor

Field Detail

fieldback to summary
private final Field field
policyback to summary
private final CMPPolicy policy

Constructor Detail

FieldAccessorback to summary
public FieldAccessor(CMPPolicy policy, Field field, String attributeName, DatabaseField databaseField, DatabaseMapping mapping, boolean isNestedAccessor)

Method Detail

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

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

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

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

Annotations
@Override
org.eclipse.persistence.internal.jpa back to summary

private final Class CMP3Policy.PropertyAccessor

extends CommonAccessor
Class Inheritance

INTERNAL: This class is used when the key class element is a property

Field Summary

Modifier and TypeField and Description
private final Method
private final CMPPolicy
private final Method
Inherited from org.eclipse.persistence.internal.jpa.CMP3Policy.CommonAccessor:
mapping

Constructor Summary

AccessConstructor and Description
public
PropertyAccessor(CMPPolicy policy, Method getMethod, Method setMethod, String attributeName, DatabaseField databaseField, DatabaseMapping mapping, boolean isNestedAccessor)

Method Summary

Modifier and TypeMethod and Description
public Object
public void
Inherited from org.eclipse.persistence.internal.jpa.CMP3Policy.CommonAccessor:
getAttributeNamegetDatabaseFieldgetMappingisNestedAccessor

Field Detail

getMethodback to summary
private final Method getMethod
policyback to summary
private final CMPPolicy policy
setMethodback to summary
private final Method setMethod

Constructor Detail

PropertyAccessorback to summary
public PropertyAccessor(CMPPolicy policy, Method getMethod, Method setMethod, String attributeName, DatabaseField databaseField, DatabaseMapping mapping, boolean isNestedAccessor)

Method Detail

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

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

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

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

Annotations
@Override
org.eclipse.persistence.internal.jpa back to summary

private final Class CMP3Policy.ValuesFieldAccessor

extends CommonAccessor
Class Inheritance

INTERNAL: This class will be used when the element of the keyclass is a virtual field.

Field Summary

Inherited from org.eclipse.persistence.internal.jpa.CMP3Policy.CommonAccessor:
mapping

Constructor Summary

AccessConstructor and Description
public
ValuesFieldAccessor(String attributeName, DatabaseField databaseField, DatabaseMapping mapping, boolean isNestedAccessor)

Method Summary

Modifier and TypeMethod and Description
public Object
public void
Inherited from org.eclipse.persistence.internal.jpa.CMP3Policy.CommonAccessor:
getAttributeNamegetDatabaseFieldgetMappingisNestedAccessor

Constructor Detail

ValuesFieldAccessorback to summary
public ValuesFieldAccessor(String attributeName, DatabaseField databaseField, DatabaseMapping mapping, boolean isNestedAccessor)

Method Detail

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

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

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

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

Annotations
@Override