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

public Class ObjectBuilder

extends CoreObjectBuilder<AbstractRecord, AbstractSession, DatabaseField, DatabaseMapping>
implements Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable
Known Direct Subclasses
org.eclipse.persistence.internal.oxm.XMLObjectBuilder
Imports
java.io.Serializable, java.sql.ResultSet, .ResultSetMetaData, .SQLException, java.util.ArrayList, .Collection, .Collections, .Enumeration, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, .Vector, java.util.concurrent.Semaphore, org.eclipse.persistence.annotations.BatchFetchType, .CacheKeyType, .IdValidation, org.eclipse.persistence.descriptors.CachePolicy, .ClassDescriptor, .DescriptorEvent, .DescriptorEventManager, .FetchGroupManager, .InheritancePolicy, org.eclipse.persistence.descriptors.changetracking.ChangeTracker, .ObjectChangePolicy, org.eclipse.persistence.exceptions.DatabaseException, .DescriptorException, .QueryException, .ValidationException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.indirection.ValueHolderInterface, org.eclipse.persistence.internal.core.descriptors.CoreObjectBuilder, org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor, .DatabasePlatform, .DatasourcePlatform, .Platform, org.eclipse.persistence.internal.expressions.ObjectExpression, .QueryKeyExpression, .SQLSelectStatement, org.eclipse.persistence.internal.helper.ConcurrencySemaphore, .ConcurrencyUtil, .DatabaseField, .DatabaseTable, .Helper, .IdentityHashSet, .InvalidObject, .ThreadCursoredList, org.eclipse.persistence.internal.identitymaps.CacheId, .CacheKey, org.eclipse.persistence.internal.indirection.ProxyIndirectionPolicy, org.eclipse.persistence.internal.queries.AttributeItem, .ContainerPolicy, .EntityFetchGroup, .JoinedAttributeManager, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .AggregateChangeRecord, .AggregateObjectChangeSet, .ArrayRecord, .ChangeRecord, .DirectToFieldChangeRecord, .MergeManager, .ObjectChangeSet, .ResultSetRecord, .SimpleResultSetRecord, .TransformationMappingChangeRecord, .UnitOfWorkChangeSet, .UnitOfWorkImpl, org.eclipse.persistence.internal.sessions.remote.ObjectDescriptor, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.mappings.AggregateObjectMapping, .ContainerMapping, .DatabaseMapping, .DatabaseMapping.WriteType, .ForeignReferenceMapping, .ObjectReferenceMapping, org.eclipse.persistence.mappings.foundation.AbstractColumnMapping, .AbstractDirectMapping, .AbstractTransformationMapping, org.eclipse.persistence.mappings.querykeys.DirectQueryKey, .QueryKey, org.eclipse.persistence.oxm.XMLContext, org.eclipse.persistence.queries.AttributeGroup, .DataReadQuery, .FetchGroup, .FetchGroupTracker, .LoadGroup, .ObjectBuildingQuery, .ObjectLevelModifyQuery, .ObjectLevelReadQuery, .QueryByExamplePolicy, .ReadAllQuery, .ReadObjectQuery, .WriteObjectQuery, org.eclipse.persistence.sessions.CopyGroup, .DatabaseRecord, .SessionProfiler, org.eclipse.persistence.sessions.remote.DistributedSession

Purpose: Object builder is one of the behavior class attached to descriptor. It is responsible for building objects, rows, and extracting primary keys from the object and the rows.

Author
Sati
Since
TOPLink/Java 1.0

Field Summary

Modifier and TypeField and Description
protected List<DatabaseMapping>
batchFetchedAttributes

PERF: Cache mapping that use batch fetching.

protected List<DatabaseMapping>
cloningMappings

PERF: Cache mappings that require cloning.

protected ClassDescriptor
protected List<DatabaseMapping>
eagerMappings

PERF: Cache mappings that are eager loaded.

protected Map<DatabaseField, DatabaseField>
fieldsMap

Used to maintain identity on the field objects.

protected boolean
hasCacheIndexesInSopObject

PERF: is there an cache index field that's would not be selected by SOP query.

protected boolean
hasInBatchFetchedAttribute

PERF: Cache mapping that use batch fetching.

protected boolean
hasWrapperPolicy

PERF: Cache if has a wrapper policy.

protected boolean
isSimple

PERF: Cache if is a simple mapping, all direct.

protected List<DatabaseMapping>
joinedAttributes

PERF: Cache mapping that use joining.

protected String
lockAttribute

attribute name corresponding to optimistic lock field, set only if optimistic locking is used

protected Map<String, DatabaseMapping>
mappingsByAttribute

Mappings keyed by attribute name.

protected Map<DatabaseField, DatabaseMapping>
mappingsByField

Mappings keyed by database field.

protected boolean
mayHaveNullInPrimaryKey

indicates whether part of primary key is unmapped - may happen only in case AggregateObject or AggregateCollection descriptor.

protected transient List<DatabaseMapping>
nonPrimaryKeyMappings

All mapping other than primary key mappings.

private transient ConcurrencySemaphore
protected List<Class<?>>
primaryKeyClassifications

The types for the primary key fields, in same order as descriptor's primary key fields.

protected transient Expression
primaryKeyExpression

Expression for querying an object by primary key.

protected List<DatabaseMapping>
primaryKeyMappings

Mapping for the primary key fields.

protected Map<DatabaseField, List<DatabaseMapping>>
readOnlyMappingsByField

List of read-only mappings using a database field.

protected List<DatabaseMapping>
relationshipMappings

PERF: Cache relationship mappings.

private static final transient Semaphore
private static final transient int
private static final transient ThreadLocal<Boolean>
SEMAPHORE_THREAD_LOCAL_VAR

Semaphore related properties.

protected AbstractDirectMapping
sequenceMapping

PERF: Cache sequence mappings.

protected boolean
shouldKeepRow

PERF: is there a mapping using indirection (could be nested in aggregate(s)), or any other reason to keep row after the object has been created.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow)

Add the primary key and its value to the Record for all the non default tables.

public void
addPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow, Object object, AbstractSession session)

Add the primary key and its value to the Record for all the non default tables.

public void
assignReturnRow(Object object, AbstractSession writeSession, AbstractRecord row, ObjectChangeSet changeSet)

Assign the fields in the row back into the object.

public void
assignReturnValueForField(Object object, ReadObjectQuery query, AbstractRecord row, DatabaseField field, Collection<E> handledMappings, ObjectChangeSet changeSet)

Assign the field value from the row to the object for all the mappings using field (read or write).

protected void
assignReturnValueToMapping(Object object, ReadObjectQuery query, AbstractRecord row, DatabaseField field, DatabaseMapping mapping, Collection<E> handledMappings, ObjectChangeSet changeSet)

INTERNAL: Assign values from objectRow to the object through the mapping.

public Object

Returns:

the sequence value or null if not assigned.
assignSequenceNumber
(Object object, AbstractSession writeSession)

INTERNAL: Update the object primary key by fetching a new sequence number from the accessor.

public Object

Returns:

the sequence value or null if not assigned.
assignSequenceNumber
(WriteObjectQuery writeQuery)

INTERNAL: Update the writeQuery's object primary key by fetching a new sequence number from the accessor.

public Object

Returns:

the sequence value or null if not assigned.
assignSequenceNumber
(WriteObjectQuery writeQuery, Object sequenceValue)

INTERNAL: Update the writeQuery's object primary key by fetching a new sequence number from the accessor.

protected Object

Returns:

the sequence value or null if not assigned.
assignSequenceNumber
(Object object, Object sequenceValue, AbstractSession writeSession, WriteObjectQuery writeQuery)

INTERNAL: Update the object primary key by fetching a new sequence number from the accessor.

public void
buildAttributesIntoObject(Object domainObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, FetchGroup executionFetchGroup, boolean forRefresh, AbstractSession targetSession)

Each mapping is recursed to assign values from the Record to the attributes in the domain object.

protected boolean

Returns:

whether the object has been populated with attributes, if not then buildAttributesIntoObject should be called.
buildAttributesIntoObjectSOP
(Object domainObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, FetchGroup executionFetchGroup, boolean forRefresh, AbstractSession targetSession)

Each mapping is recursed to assign values from the Record to the attributes in the domain object.

public void
buildAttributesIntoShallowObject(Object original, AbstractRecord databaseRow, ObjectBuildingQuery query)

INTERNAL: For reading through the write connection when in transaction, We need a partially populated original, so that we can build a clone using the copy policy, even though we can't put this original in the shared cache yet; just build a shallow original (i.e. just enough to copy over the primary key and some direct attributes) and keep it on the UOW.

public void
buildAttributesIntoWorkingCopyClone(Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, boolean forRefresh)

INTERNAL: For reading through the write connection when in transaction, populate the clone directly from the database row.

protected boolean

Returns:

whether the object has been populated with attributes, if not then buildAttributesIntoWorkingCopyClone should be called.
buildAttributesIntoWorkingCopyCloneSOP
(Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, boolean forRefresh)

For reading through the write connection when in transaction, populate the clone directly from the database row.

public Object
buildBackupClone(Object clone, UnitOfWorkImpl unitOfWork)

Returns the backup clone of the specified object.

public Expression
buildDeleteExpression(DatabaseTable table, AbstractRecord row, boolean usesOptimisticLocking)

Build and return the expression to use as the where clause to delete an object.

public Expression
buildExpressionFromExample(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map<K, V> processedObjects, AbstractSession session)

INTERNAL: This method is used when Query By Example is used.

public Object
buildNewInstance()

Implements abstract org.eclipse.persistence.internal.core.descriptors.CoreObjectBuilder.buildNewInstance.

Return a new instance of the receiver's javaClass.
public Object
buildObject(ObjectLevelReadQuery query, AbstractRecord databaseRow)

Return an instance of the receivers javaClass.

public Object
buildObject(ObjectBuildingQuery query, AbstractRecord databaseRow, JoinedAttributeManager joinManager)

Return an instance of the receivers javaClass.

public Object
buildObject(ObjectBuildingQuery query, AbstractRecord databaseRow, JoinedAttributeManager joinManager, AbstractSession session, ClassDescriptor concreteDescriptor, InheritancePolicy inheritancePolicy, boolean isUnitOfWork, boolean shouldCacheQueryResults, boolean shouldUseWrapperPolicy)

Return an instance of the receivers javaClass.

protected Object
buildObject(boolean returnCacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager)

Return an instance of the receivers javaClass.

public Object
buildObjectFromResultSet(ObjectBuildingQuery query, JoinedAttributeManager joinManager, ResultSet resultSet, AbstractSession executionSession, DatabaseAccessor accessor, ResultSetMetaData metaData, DatabasePlatform platform, Vector<E> fieldsList, DatabaseField[] fieldsArray)

INTERNAL: Builds a working copy clone directly from a result set.

private Object
buildObjectFromResultSetInternal(ObjectBuildingQuery query, JoinedAttributeManager joinManager, ResultSet resultSet, AbstractSession executionSession, DatabaseAccessor accessor, ResultSetMetaData metaData, DatabasePlatform platform, Vector<E> fieldsList, DatabaseField[] fieldsArray)

INTERNAL: Builds a working copy clone directly from a result set.

private Object
buildObjectInternal(ObjectBuildingQuery query, AbstractRecord databaseRow, JoinedAttributeManager joinManager, AbstractSession session, ClassDescriptor concreteDescriptor, InheritancePolicy inheritancePolicy, boolean isUnitOfWork, boolean shouldCacheQueryResults, boolean shouldUseWrapperPolicy)

Return an instance of the receivers javaClass.

protected Object
buildObjectInUnitOfWork(ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor)

For executing all reads on the UnitOfWork, the session when building objects from rows will now be the UnitOfWork.

public Object
buildObjectsFromCursorInto(ReadAllQuery query, List<E> databaseRows, Object domainObjects)

Return a container which contains the instances of the receivers javaClass.

public Object
buildObjectsFromResultSetInto(ReadAllQuery query, ResultSet resultSet, Vector<E> fields, DatabaseField[] fieldsArray, Object domainObjects)

Version of buildObjectsInto method that takes call instead of rows.

public Object
buildObjectsInto(ReadAllQuery query, List<E> databaseRows, Object domainObjects)

Return a container which contains the instances of the receivers javaClass.

public void
buildPrimaryKeyAttributesIntoObject(Object original, AbstractRecord databaseRow, ObjectBuildingQuery query, AbstractSession session)

INTERNAL: Build just the primary key mappings into the object.

public Expression
buildPrimaryKeyExpression(DatabaseTable table)

Build the primary key expression for the secondary table.

public Expression
buildPrimaryKeyExpressionFromKeys(Object primaryKey, AbstractSession session)

Build the primary key expression from the specified primary key values.

public Expression
buildPrimaryKeyExpressionFromObject(Object domainObject, AbstractSession session)

Build the primary key expression from the specified domain object.

protected Object
buildProtectedObject(boolean returnCacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager)

Return an instance of the receivers javaClass.

public AbstractRecord
buildRow(Object object, AbstractSession session, DatabaseMapping.WriteType writeType)

Build the row representation of an object.

public AbstractRecord
buildRow(AbstractRecord databaseRow, Object object, AbstractSession session, DatabaseMapping.WriteType writeType)

Build the row representation of an object.

public AbstractRecord
buildRowForShallowInsert(Object object, AbstractSession session)

Build the row representation of the object for update.

public AbstractRecord
buildRowForShallowInsert(AbstractRecord databaseRow, Object object, AbstractSession session)

Build the row representation of the object for update.

public AbstractRecord
buildRowForTranslation(Object object, AbstractSession session)

Build the row representation of an object.

public AbstractRecord
buildRowForUpdate(WriteObjectQuery query)

Build the row representation of the object for update.

public AbstractRecord
buildRowForUpdate(AbstractRecord databaseRow, WriteObjectQuery query)

Build into the row representation of the object for update.

public AbstractRecord
buildRowForUpdateAfterShallowInsert(Object object, AbstractSession session, DatabaseTable table)

Build the row representation of the object that contains only the fields nullified by shallow insert.

public AbstractRecord
buildRowForUpdateAfterShallowInsert(AbstractRecord databaseRow, Object object, AbstractSession session, DatabaseTable table)

Build the row representation of the object that contains only the fields nullified by shallow insert.

public AbstractRecord
buildRowForUpdateBeforeShallowDelete(Object object, AbstractSession session, DatabaseTable table)

Build the row representation of the object that contains only the fields nullified by shallow insert, with all values set to null.

public AbstractRecord
buildRowForUpdateBeforeShallowDelete(AbstractRecord databaseRow, Object object, AbstractSession session, DatabaseTable table)

Build the row representation of the object that contains only the fields nullified by shallow insert, with all values set to null.

public AbstractRecord
buildRowForUpdateWithChangeSet(WriteObjectQuery query)

Build the row representation of the object for update.

public AbstractRecord
buildRowForWhereClause(ObjectLevelModifyQuery query)

Build the row representation of an object.

public AbstractRecord
buildRowFromPrimaryKeyValues(Object key, AbstractSession session)

Build the row from the primary key values.

public AbstractRecord
buildRowWithChangeSet(AbstractRecord databaseRow, ObjectChangeSet objectChangeSet, AbstractSession session, DatabaseMapping.WriteType writeType)

Build the row representation of an object.

public AbstractRecord
buildTemplateInsertRow(AbstractSession session)

Build the row of all of the fields used for insertion.

public void
public AbstractRecord
buildTemplateUpdateRow(AbstractSession session)

Build the row representation of the object for update.

public Expression
buildUpdateExpression(DatabaseTable table, AbstractRecord transactionRow, AbstractRecord modifyRow)

Build and return the expression to use as the where clause to an update object.

protected Object
buildWorkingCopyCloneFromRow(ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, Object primaryKey, CacheKey preFetchedCacheKey)

INTERNAL: Builds a working copy clone directly from the database row.

protected Object
buildWorkingCopyCloneNormally(ObjectBuildingQuery query, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager)

buildWorkingCopyCloneFromRow is an alternative to this which is the normal behavior.

public void
cacheForeignKeyValues(AbstractRecord databaseRecord, CacheKey cacheKey, AbstractSession session)

INTERNAL: This method is used to store the FK values used for this mapping in the cachekey.

public void
cacheForeignKeyValues(Object source, CacheKey cacheKey, ClassDescriptor descriptor, AbstractSession session)

INTERNAL: This method is used to store the FK values used for this mapping in the cachekey.

public void
cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map<K, V> newObjects, Map<K, V> unregisteredExistingObjects, Map<K, V> visitedObjects, UnitOfWorkImpl uow, Set<E> cascadeErrors)

INTERNAL: Cascade discover and persist new objects during commit.

public void
cascadePerformRemove(Object object, UnitOfWorkImpl uow, Map<K, V> visitedObjects)

INTERNAL: This method is used by the UnitOfWork to cascade registration of new objects.

public void
cascadePerformRemovePrivateOwnedObjectFromChangeSet(Object object, UnitOfWorkImpl uow, Map<K, V> visitedObjects)

INTERNAL: This method is used to iterate over the specified object's mappings and cascade remove orphaned private owned objects from the UnitOfWorkChangeSet and IdentityMap.

public void
cascadeRegisterNewForCreate(Object object, UnitOfWorkImpl uow, Map<K, V> visitedObjects)

INTERNAL: This method is used by the UnitOfWork to cascade registration of new objects.

public void
clearPrimaryKey(Object object)

Clear any primary key cache data in the object.

public Object
clone()

Overrides java.lang.Object.clone.

Returns a clone of itself.
public ObjectChangeSet

Returns:

ObjectChangeSet
compareForChange
(Object clone, Object backUp, UnitOfWorkChangeSet changeSet, AbstractSession session)

INTERNAL: This method creates a records change set for a particular object.

public boolean
compareObjects(Object firstObject, Object secondObject, AbstractSession session)

Compares the two specified objects

public void
copyInto(Object source, Object target, boolean cloneOneToOneValueHolders)

Copy each attribute from one object into the other.

public void
copyInto(Object source, Object target)

Copy each attribute from one object into the other.

public Object
copyObject(Object original, CopyGroup copyGroup)

Return a copy of the object.

protected void
copyQueryInfoToCacheKey(CacheKey cacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, ClassDescriptor concreteDescriptor)

Initialize a cache key.

public ObjectChangeSet

Returns:

ObjectChangeSet the newly created changeSet representing the clone object
createObjectChangeSet
(Object
the object to convert to a changeSet.
clone
,
UnitOfWorkChangeSet
the owner of this changeSet.
uowChangeSet
,
AbstractSession session)

INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.

public ObjectChangeSet

Returns:

ObjectChangeSet the newly created changeSet representing the clone object
createObjectChangeSet
(Object
the object to convert to a changeSet.
clone
,
UnitOfWorkChangeSet
the owner of this changeSet.
uowChangeSet
,
boolean
signifies if the clone object is a new object.
isNew
,
AbstractSession session)

INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.

public ObjectChangeSet

Returns:

ObjectChangeSet the newly created changeSet representing the clone object
createObjectChangeSet
(Object
the object to convert to a changeSet.
clone
,
UnitOfWorkChangeSet
the owner of this changeSet.
uowChangeSet
,
boolean
signifies if the clone object is a new object.
isNew
,
boolean
signifies if the primary key of the change set should be updated if existing.
assignPrimaryKeyIfExisting
,
AbstractSession session)

INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.

public void
createPrimaryKeyExpression(AbstractSession session)

Creates and stores primary key expression.

public AbstractRecord
createRecord(AbstractSession session)

Implements abstract org.eclipse.persistence.internal.core.descriptors.CoreObjectBuilder.createRecord.

Create a new row/record for the object builder.
public AbstractRecord
createRecord(int size, AbstractSession session)

Create a new row/record for the object builder.

protected AbstractRecord
createRecordForPKExtraction(int size, AbstractSession session)

Create a new row/record for the object builder.

public AbstractRecord
public Object
extractPrimaryKeyFromExpression(boolean requiresExactMatch, Expression expression, AbstractRecord translationRow, AbstractSession session)

Return the row with primary keys and their values from the given expression.

public Object
extractPrimaryKeyFromObject(Object domainObject, AbstractSession session)

Implements abstract org.eclipse.persistence.internal.core.descriptors.CoreObjectBuilder.extractPrimaryKeyFromObject.

Extract primary key attribute values from the domainObject.
public Object
extractPrimaryKeyFromObject(Object domainObject, AbstractSession session, boolean shouldReturnNullIfNull)

Extract primary key attribute values from the domainObject.

public Object
extractPrimaryKeyFromRow(AbstractRecord databaseRow, AbstractSession session)

Extract primary key values from the specified row.

public AbstractRecord
extractPrimaryKeyRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session)

Return the row with primary keys and their values from the given expression.

public AbstractRecord
extractPrimaryKeyRowFromObject(Object domainObject, AbstractSession session)

Extract primary key attribute values from the domainObject.

public AbstractRecord
extractRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session)

Return the row from the given expression.

public Object
extractValueFromObjectForField(Object domainObject, DatabaseField field, AbstractSession session)

Extract the value of the primary key attribute from the specified object.

public void
fixObjectReferences(Object object, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session)

INTERNAL: An object has been serialized from the server to the client.

public ChangeRecord
getBaseChangeRecordForField(ObjectChangeSet objectChangeSet, Object object, DatabaseField databaseField, AbstractSession session)

Return the base ChangeRecord for the given DatabaseField.

public DatabaseMapping
getBaseMappingForField(DatabaseField databaseField)

Return the base mapping for the given DatabaseField.

public Object
getBaseValueForField(DatabaseField databaseField, Object domainObject)

Return the base value that is mapped to for given field.

public List<DatabaseMapping>
getBatchFetchedAttributes()

Return the mappings that are always batch fetched.

public List<DatabaseMapping>
getCloningMappings()

PERF: Return all mappings that require cloning.

public ClassDescriptor
getDescriptor()

Return the descriptor

public List<DatabaseMapping>
getEagerMappings()

PERF: Return all mappings that are eager loaded (but use indirection).

public Class<?>
getFieldClassification(DatabaseField fieldToClassify)

INTERNAL: Return the classification for the field contained in the mapping.

public DatabaseField
getFieldForQueryKeyName(String name)

Return the field used for the query key name.

public Map<DatabaseField, DatabaseField>
getFieldsMap()

Return the fields map.

public List<DatabaseMapping>
getJoinedAttributes()

Answers the attributes which are always joined to the original query on reads.

public String
public DatabaseMapping
getMappingForAttributeName(String name)

Return the mapping for the specified attribute name.

public DatabaseMapping
protected Map<String, DatabaseMapping>
getMappingsByAttribute()

Return all the mapping to attribute associations

public Map<DatabaseField, DatabaseMapping>
getMappingsByField()

INTERNAL: Return all the mapping to field associations

protected List<DatabaseMapping>
getNonPrimaryKeyMappings()

Return the non primary key mappings.

public Object
getParentObjectForField(DatabaseField databaseField, Object domainObject)

Return the base value that is mapped to for given field.

public List<Class<?>>
getPrimaryKeyClassifications()

Return primary key classifications.

public Expression
getPrimaryKeyExpression()

Return the primary key expression

public List<DatabaseMapping>
getPrimaryKeyMappings()

Return primary key mappings.

public Map<DatabaseField, List<DatabaseMapping>>
getReadOnlyMappingsByField()

INTERNAL: Return all the read-only mapping to field associations

public List<DatabaseMapping>
getReadOnlyMappingsForField(DatabaseField field)

Return all the read-only mapping for the specified field.

public List<DatabaseMapping>
getRelationshipMappings()

PERF: Return all relationship mappings.

public AbstractDirectMapping
getSequenceMapping()

PERF: Return the sequence mapping.

public DatabaseField
getTargetFieldForQueryKeyName(String queryKeyName)

INTERNAL: return a database field based on a query key name

public boolean
hasBatchFetchedAttributes()

Return is any mappings are always batch fetched.

public boolean
public boolean
hasInBatchFetchedAttribute()

Return is any mappings are always batch fetched using IN.

public boolean
hasJoinedAttributes()

Answers if any attributes are to be joined / returned in the same select statement.

public boolean
hasWrapperPolicy()

Return if the descriptor has a wrapper policy.

protected void
public void
initialize(AbstractSession session)

Cache all the mappings by their attribute and fields.

public void
initializeBatchFetchedAttributes()

INTERNAL: Iterates through all one to one mappings and checks if any of them use batch fetching.

public void
initializeJoinedAttributes()

INTERNAL: Iterates through all one to one mappings and checks if any of them use joining.

public void
initializePrimaryKey(AbstractSession session)

Cache primary key and non primary key mappings.

public Object
instantiateClone(Object domainObject, AbstractSession session)

Returns the clone of the specified object.

public void
instantiateEagerMappings(Object object, AbstractSession session)

Force instantiation to any eager mappings.

public Object
instantiateWorkingCopyClone(Object domainObject, AbstractSession session)

Returns the clone of the specified object.

public Object
instantiateWorkingCopyCloneFromRow(AbstractRecord row, ObjectBuildingQuery query, Object primaryKey, UnitOfWorkImpl unitOfWork)

It is now possible to build working copy clones directly from rows.

public boolean
isPrimaryKeyComponentInvalid(Object keyValue, int index)

public boolean
isPrimaryKeyExpression(boolean requiresExactMatch, Expression expression, AbstractSession session)

Return if the expression is by primary key.

public boolean
public boolean
isSimple()

PERF: Return if the descriptor has no complex mappings, all direct.

public boolean
public void
iterate(DescriptorIterator iterator)

INTERNAL: Perform the iteration operation on the objects attributes through the mappings.

public void
load(final Object object, AttributeGroup group, final AbstractSession session, final boolean fromFetchGroup)

Force instantiation to any mappings in the load group.

public void
loadAll(Object object, AbstractSession session)

Force instantiation of all indirections.

public void
loadAll(Object object, AbstractSession session, IdentityHashSet loaded)

protected void
loadBatchReadAttributes(ClassDescriptor concreteDescriptor, Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, boolean isTargetProtected)

protected void
loadJoinedAttributes(ClassDescriptor concreteDescriptor, Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, JoinedAttributeManager joinManager, ObjectBuildingQuery query, boolean isTargetProtected)

public void
mergeChangesIntoObject(Object target, ObjectChangeSet changeSet, Object source, MergeManager mergeManager, AbstractSession targetSession)

INTERNAL: Merge changes between the objects, this merge algorithm is dependent on the merge manager.

public void
mergeChangesIntoObject(Object target, ObjectChangeSet changeSet, Object source, MergeManager mergeManager, AbstractSession targetSession, boolean isTargetCloneOfOriginal, boolean shouldMergeFetchGroup)

INTERNAL: Merge changes between the objects, this merge algorithm is dependent on the merge manager.

public void
mergeIntoObject(Object target, boolean isUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession)

INTERNAL: Merge the contents of one object into another, this merge algorithm is dependent on the merge manager.

public void
mergeIntoObject(Object target, ObjectChangeSet changeSet, boolean isUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession, boolean cascadeOnly, boolean isTargetCloneOfOriginal, boolean shouldMergeFetchGroup)

INTERNAL: Merge the contents of one object into another, this merge algorithm is dependent on the merge manager.

public void
populateAttributesForClone(Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession)

Clones the attributes of the specified object.

protected void
postBuildAttributesIntoObjectEvent(Object domainObject, AbstractRecord databaseRow, ObjectBuildingQuery query, boolean forRefresh)

protected void
public void
postInitialize(AbstractSession session)

INTERNAL: Post initializations after mappings are initialized.

public void
recordPrivateOwnedRemovals(Object object, UnitOfWorkImpl uow, boolean initialPass)

protected boolean
refreshObjectIfRequired(ClassDescriptor concreteDescriptor, CacheKey cacheKey, Object domainObject, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session, boolean targetIsProtected)

This method is called when a cached Entity needs to be refreshed

public void
rehashFieldDependancies(AbstractSession session)

Rehash any maps based on fields.

private void
revertFetchGroupData(Object domainObject, ClassDescriptor concreteDescriptor, CacheKey cacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session, boolean targetIsProtected)

Clean up the cached object data and only revert the fetch group data back to the cached object.

public void
setDescriptor(ClassDescriptor aDescriptor)

Set the descriptor.

protected void
setFieldsMap(Map<K, V> fieldsMap)

Return the fields map.

public void
setHasInBatchFetchedAttribute(boolean hasInBatchFetchedAttribute)

Set if any mappings are always batch fetched using IN.

public void
setHasWrapperPolicy(boolean hasWrapperPolicy)

Set if the descriptor has a wrapper policy.

protected void
setMappingsByAttribute(Map<String, DatabaseMapping> theAttributeMappings)

All the mappings and their respective attribute associations are cached for performance improvement.

public void
setMappingsByField(Map<DatabaseField, DatabaseMapping> theFieldMappings)

INTERNAL: All the mappings and their respective field associations are cached for performance improvement.

protected void
setNonPrimaryKeyMappings(List<DatabaseMapping> theNonPrimaryKeyMappings)

The non primary key mappings are cached to improve performance.

public void
setPrimaryKeyClassifications(List<Class<?>> primaryKeyClassifications)

INTERNAL: Set primary key classifications.

public void
setPrimaryKeyExpression(Expression criteria)

The primary key expression is cached to improve performance.

protected void
setPrimaryKeyMappings(List<DatabaseMapping> thePrimaryKeyMappings)

The primary key mappings are cached to improve performance.

public void
setReadOnlyMappingsByField(Map<DatabaseField, List<DatabaseMapping>> theReadOnlyFieldMappings)

INTERNAL: All the read-only mappings and their respective field associations are cached for performance improvement.

public void
setSequenceMapping(AbstractDirectMapping sequenceMapping)

PERF: Set the sequence mapping.

public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
trimFieldsForInsert(AbstractSession session, AbstractRecord databaseRow)

INTERNAL Remove a potential sequence number field and invoke the ReturningPolicy trimModifyRowsForInsert method

public Object
unwrapObject(Object proxy, AbstractSession session)

Unwrap the object if required.

public void
updateCachedAttributes(PersistenceEntity persistenceEntity, CacheKey cacheKey, Object primaryKey)

INTERNAL: Used to updated any attributes that may be cached on a woven entity

public void
validate(AbstractSession session)

Validates the object builder.

public boolean
verifyDelete(Object object, AbstractSession session)

Verify that an object has been deleted from the database.

public Object
wrapObject(Object implementation, AbstractSession session)

Wrap the object if required.

public AbstractRecord
writeIntoRowFromPrimaryKeyValues(AbstractRecord row, Object primaryKey, AbstractSession session, boolean convert)

Build the row from the primary key values.