Class ObjectBuilder
- java.lang.Object
-
- org.eclipse.persistence.internal.core.descriptors.CoreObjectBuilder<AbstractRecord,AbstractSession,DatabaseField,DatabaseMapping>
-
- org.eclipse.persistence.internal.descriptors.ObjectBuilder
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
XMLObjectBuilder
public class ObjectBuilder extends CoreObjectBuilder<AbstractRecord,AbstractSession,DatabaseField,DatabaseMapping> implements java.lang.Cloneable, java.io.Serializable
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.
- Since:
- TOPLink/Java 1.0
- Author:
- Sati
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<DatabaseMapping>batchFetchedAttributesPERF: Cache mapping that use batch fetching.protected java.util.List<DatabaseMapping>cloningMappingsPERF: Cache mappings that require cloning.protected ClassDescriptordescriptorprotected java.util.List<DatabaseMapping>eagerMappingsPERF: Cache mappings that are eager loaded.protected java.util.Map<DatabaseField,DatabaseField>fieldsMapUsed to maintain identity on the field objects.protected booleanhasCacheIndexesInSopObjectPERF: is there an cache index field that's would not be selected by SOP query.protected booleanhasInBatchFetchedAttributePERF: Cache mapping that use batch fetching.protected booleanhasWrapperPolicyPERF: Cache if has a wrapper policy.protected booleanisSimplePERF: Cache if is a simple mapping, all direct.protected java.util.List<DatabaseMapping>joinedAttributesPERF: Cache mapping that use joining.protected java.lang.StringlockAttributeattribute name corresponding to optimistic lock field, set only if optimistic locking is usedprotected java.util.Map<java.lang.String,DatabaseMapping>mappingsByAttributeMappings keyed by attribute name.protected java.util.Map<DatabaseField,DatabaseMapping>mappingsByFieldMappings keyed by database field.protected booleanmayHaveNullInPrimaryKeyindicates whether part of primary key is unmapped - may happen only in case AggregateObject or AggregateCollection descriptor.protected java.util.List<DatabaseMapping>nonPrimaryKeyMappingsAll mapping other than primary key mappings.protected java.util.List<java.lang.Class>primaryKeyClassificationsThe types for the primary key fields, in same order as descriptor's primary key fields.protected ExpressionprimaryKeyExpressionExpression for querying an object by primary key.protected java.util.List<DatabaseMapping>primaryKeyMappingsMapping for the primary key fields.protected java.util.Map<DatabaseField,java.util.List<DatabaseMapping>>readOnlyMappingsByFieldList of read-only mappings using a database field.protected java.util.List<DatabaseMapping>relationshipMappingsPERF: Cache relationship mappings.protected AbstractDirectMappingsequenceMappingPERF: Cache sequence mappings.protected booleanshouldKeepRowPERF: 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
Constructors Constructor Description ObjectBuilder(ClassDescriptor descriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow)Add the primary key and its value to the Record for all the non default tables.voidaddPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow, java.lang.Object object, AbstractSession session)Add the primary key and its value to the Record for all the non default tables.voidassignReturnRow(java.lang.Object object, AbstractSession writeSession, AbstractRecord row, ObjectChangeSet changeSet)Assign the fields in the row back into the object.voidassignReturnValueForField(java.lang.Object object, ReadObjectQuery query, AbstractRecord row, DatabaseField field, java.util.Collection handledMappings, ObjectChangeSet changeSet)Assign the field value from the row to the object for all the mappings using field (read or write).protected voidassignReturnValueToMapping(java.lang.Object object, ReadObjectQuery query, AbstractRecord row, DatabaseField field, DatabaseMapping mapping, java.util.Collection handledMappings, ObjectChangeSet changeSet)INTERNAL: Assign values from objectRow to the object through the mapping.protected java.lang.ObjectassignSequenceNumber(java.lang.Object object, java.lang.Object sequenceValue, AbstractSession writeSession, WriteObjectQuery writeQuery)INTERNAL: Update the object primary key by fetching a new sequence number from the accessor.java.lang.ObjectassignSequenceNumber(java.lang.Object object, AbstractSession writeSession)INTERNAL: Update the object primary key by fetching a new sequence number from the accessor.java.lang.ObjectassignSequenceNumber(WriteObjectQuery writeQuery)INTERNAL: Update the writeQuery's object primary key by fetching a new sequence number from the accessor.java.lang.ObjectassignSequenceNumber(WriteObjectQuery writeQuery, java.lang.Object sequenceValue)INTERNAL: Update the writeQuery's object primary key by fetching a new sequence number from the accessor.voidbuildAttributesIntoObject(java.lang.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 booleanbuildAttributesIntoObjectSOP(java.lang.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.voidbuildAttributesIntoShallowObject(java.lang.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.voidbuildAttributesIntoWorkingCopyClone(java.lang.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 booleanbuildAttributesIntoWorkingCopyCloneSOP(java.lang.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.java.lang.ObjectbuildBackupClone(java.lang.Object clone, UnitOfWorkImpl unitOfWork)Returns the backup clone of the specified object.ExpressionbuildDeleteExpression(DatabaseTable table, AbstractRecord row, boolean usesOptimisticLocking)Build and return the expression to use as the where clause to delete an object.ExpressionbuildExpressionFromExample(java.lang.Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, java.util.Map processedObjects, AbstractSession session)INTERNAL: This method is used when Query By Example is used.java.lang.ObjectbuildNewInstance()Return a new instance of the receiver's javaClass.protected java.lang.ObjectbuildObject(boolean returnCacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, java.lang.Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager)Return an instance of the receivers javaClass.java.lang.ObjectbuildObject(ObjectBuildingQuery query, AbstractRecord databaseRow, JoinedAttributeManager joinManager)Return an instance of the receivers javaClass.java.lang.ObjectbuildObject(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.java.lang.ObjectbuildObject(ObjectLevelReadQuery query, AbstractRecord databaseRow)Return an instance of the receivers javaClass.java.lang.ObjectbuildObjectFromResultSet(ObjectBuildingQuery query, JoinedAttributeManager joinManager, java.sql.ResultSet resultSet, AbstractSession executionSession, DatabaseAccessor accessor, java.sql.ResultSetMetaData metaData, DatabasePlatform platform, java.util.Vector fieldsList, DatabaseField[] fieldsArray)INTERNAL: Builds a working copy clone directly from a result set.protected java.lang.ObjectbuildObjectInUnitOfWork(ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, java.lang.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.java.lang.ObjectbuildObjectsFromCursorInto(ReadAllQuery query, java.util.List databaseRows, java.lang.Object domainObjects)Return a container which contains the instances of the receivers javaClass.java.lang.ObjectbuildObjectsFromResultSetInto(ReadAllQuery query, java.sql.ResultSet resultSet, java.util.Vector fields, DatabaseField[] fieldsArray, java.lang.Object domainObjects)Version of buildObjectsInto method that takes call instead of rows.java.lang.ObjectbuildObjectsInto(ReadAllQuery query, java.util.List databaseRows, java.lang.Object domainObjects)Return a container which contains the instances of the receivers javaClass.voidbuildPrimaryKeyAttributesIntoObject(java.lang.Object original, AbstractRecord databaseRow, ObjectBuildingQuery query, AbstractSession session)INTERNAL: Build just the primary key mappings into the object.ExpressionbuildPrimaryKeyExpression(DatabaseTable table)Build the primary key expression for the secondary table.ExpressionbuildPrimaryKeyExpressionFromKeys(java.lang.Object primaryKey, AbstractSession session)Build the primary key expression from the specified primary key values.ExpressionbuildPrimaryKeyExpressionFromObject(java.lang.Object domainObject, AbstractSession session)Build the primary key expression from the specified domain object.protected java.lang.ObjectbuildProtectedObject(boolean returnCacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, java.lang.Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager)Return an instance of the receivers javaClass.AbstractRecordbuildRow(java.lang.Object object, AbstractSession session, DatabaseMapping.WriteType writeType)Build the row representation of an object.AbstractRecordbuildRow(AbstractRecord databaseRow, java.lang.Object object, AbstractSession session, DatabaseMapping.WriteType writeType)Build the row representation of an object.AbstractRecordbuildRowForShallowInsert(java.lang.Object object, AbstractSession session)Build the row representation of the object for update.AbstractRecordbuildRowForShallowInsert(AbstractRecord databaseRow, java.lang.Object object, AbstractSession session)Build the row representation of the object for update.AbstractRecordbuildRowForTranslation(java.lang.Object object, AbstractSession session)Build the row representation of an object.AbstractRecordbuildRowForUpdate(AbstractRecord databaseRow, WriteObjectQuery query)Build into the row representation of the object for update.AbstractRecordbuildRowForUpdate(WriteObjectQuery query)Build the row representation of the object for update.AbstractRecordbuildRowForUpdateAfterShallowInsert(java.lang.Object object, AbstractSession session, DatabaseTable table)Build the row representation of the object that contains only the fields nullified by shallow insert.AbstractRecordbuildRowForUpdateAfterShallowInsert(AbstractRecord databaseRow, java.lang.Object object, AbstractSession session, DatabaseTable table)Build the row representation of the object that contains only the fields nullified by shallow insert.AbstractRecordbuildRowForUpdateBeforeShallowDelete(java.lang.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.AbstractRecordbuildRowForUpdateBeforeShallowDelete(AbstractRecord databaseRow, java.lang.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.AbstractRecordbuildRowForUpdateWithChangeSet(WriteObjectQuery query)Build the row representation of the object for update.AbstractRecordbuildRowForWhereClause(ObjectLevelModifyQuery query)Build the row representation of an object.AbstractRecordbuildRowFromPrimaryKeyValues(java.lang.Object key, AbstractSession session)Build the row from the primary key values.AbstractRecordbuildRowWithChangeSet(AbstractRecord databaseRow, ObjectChangeSet objectChangeSet, AbstractSession session, DatabaseMapping.WriteType writeType)Build the row representation of an object.AbstractRecordbuildTemplateInsertRow(AbstractSession session)Build the row of all of the fields used for insertion.voidbuildTemplateInsertRow(AbstractSession session, AbstractRecord databaseRow)AbstractRecordbuildTemplateUpdateRow(AbstractSession session)Build the row representation of the object for update.ExpressionbuildUpdateExpression(DatabaseTable table, AbstractRecord transactionRow, AbstractRecord modifyRow)Build and return the expression to use as the where clause to an update object.protected java.lang.ObjectbuildWorkingCopyCloneFromRow(ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, java.lang.Object primaryKey, CacheKey preFetchedCacheKey)INTERNAL: Builds a working copy clone directly from the database row.protected java.lang.ObjectbuildWorkingCopyCloneNormally(ObjectBuildingQuery query, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, java.lang.Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager)buildWorkingCopyCloneFromRow is an alternative to this which is the normal behavior.voidcacheForeignKeyValues(java.lang.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.voidcacheForeignKeyValues(AbstractRecord databaseRecord, CacheKey cacheKey, AbstractSession session)INTERNAL: This method is used to store the FK values used for this mapping in the cachekey.voidcascadeDiscoverAndPersistUnregisteredNewObjects(java.lang.Object object, java.util.Map newObjects, java.util.Map unregisteredExistingObjects, java.util.Map visitedObjects, UnitOfWorkImpl uow, java.util.Set cascadeErrors)INTERNAL: Cascade discover and persist new objects during commit.voidcascadePerformRemove(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map visitedObjects)INTERNAL: This method is used by the UnitOfWork to cascade registration of new objects.voidcascadePerformRemovePrivateOwnedObjectFromChangeSet(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map 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.voidcascadeRegisterNewForCreate(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map visitedObjects)INTERNAL: This method is used by the UnitOfWork to cascade registration of new objects.voidclearPrimaryKey(java.lang.Object object)Clear any primary key cache data in the object.java.lang.Objectclone()Returns a clone of itself.ObjectChangeSetcompareForChange(java.lang.Object clone, java.lang.Object backUp, UnitOfWorkChangeSet changeSet, AbstractSession session)INTERNAL: This method creates a records change set for a particular object.booleancompareObjects(java.lang.Object firstObject, java.lang.Object secondObject, AbstractSession session)Compares the two specified objectsvoidcopyInto(java.lang.Object source, java.lang.Object target)Copy each attribute from one object into the other.voidcopyInto(java.lang.Object source, java.lang.Object target, boolean cloneOneToOneValueHolders)Copy each attribute from one object into the other.java.lang.ObjectcopyObject(java.lang.Object original, CopyGroup copyGroup)Return a copy of the object.protected voidcopyQueryInfoToCacheKey(CacheKey cacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, ClassDescriptor concreteDescriptor)Initialize a cache key.ObjectChangeSetcreateObjectChangeSet(java.lang.Object clone, UnitOfWorkChangeSet uowChangeSet, boolean isNew, boolean assignPrimaryKeyIfExisting, AbstractSession session)INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.ObjectChangeSetcreateObjectChangeSet(java.lang.Object clone, UnitOfWorkChangeSet uowChangeSet, boolean isNew, AbstractSession session)INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.ObjectChangeSetcreateObjectChangeSet(java.lang.Object clone, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.voidcreatePrimaryKeyExpression(AbstractSession session)Creates and stores primary key expression.AbstractRecordcreateRecord(int size, AbstractSession session)Create a new row/record for the object builder.AbstractRecordcreateRecord(AbstractSession session)Create a new row/record for the object builder.protected AbstractRecordcreateRecordForPKExtraction(int size, AbstractSession session)Create a new row/record for the object builder.AbstractRecordcreateRecordFromXMLContext(XMLContext context)Create a new row/record from XMLContext.java.lang.ObjectextractPrimaryKeyFromExpression(boolean requiresExactMatch, Expression expression, AbstractRecord translationRow, AbstractSession session)Return the row with primary keys and their values from the given expression.java.lang.ObjectextractPrimaryKeyFromObject(java.lang.Object domainObject, AbstractSession session)Extract primary key attribute values from the domainObject.java.lang.ObjectextractPrimaryKeyFromObject(java.lang.Object domainObject, AbstractSession session, boolean shouldReturnNullIfNull)Extract primary key attribute values from the domainObject.java.lang.ObjectextractPrimaryKeyFromRow(AbstractRecord databaseRow, AbstractSession session)Extract primary key values from the specified row.AbstractRecordextractPrimaryKeyRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session)Return the row with primary keys and their values from the given expression.AbstractRecordextractPrimaryKeyRowFromObject(java.lang.Object domainObject, AbstractSession session)Extract primary key attribute values from the domainObject.AbstractRecordextractRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session)Return the row from the given expression.java.lang.ObjectextractValueFromObjectForField(java.lang.Object domainObject, DatabaseField field, AbstractSession session)Extract the value of the primary key attribute from the specified object.voidfixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, DistributedSession session)INTERNAL: An object has been serialized from the server to the client.ChangeRecordgetBaseChangeRecordForField(ObjectChangeSet objectChangeSet, java.lang.Object object, DatabaseField databaseField, AbstractSession session)Return the base ChangeRecord for the given DatabaseField.DatabaseMappinggetBaseMappingForField(DatabaseField databaseField)Return the base mapping for the given DatabaseField.java.lang.ObjectgetBaseValueForField(DatabaseField databaseField, java.lang.Object domainObject)Return the base value that is mapped to for given field.java.util.List<DatabaseMapping>getBatchFetchedAttributes()Return the mappings that are always batch fetched.java.util.List<DatabaseMapping>getCloningMappings()PERF: Return all mappings that require cloning.ClassDescriptorgetDescriptor()Return the descriptorjava.util.List<DatabaseMapping>getEagerMappings()PERF: Return all mappings that are eager loaded (but use indirection).java.lang.ClassgetFieldClassification(DatabaseField fieldToClassify)INTERNAL: Return the classification for the field contained in the mapping.DatabaseFieldgetFieldForQueryKeyName(java.lang.String name)Return the field used for the query key name.java.util.Map<DatabaseField,DatabaseField>getFieldsMap()Return the fields map.java.util.List<DatabaseMapping>getJoinedAttributes()Answers the attributes which are always joined to the original query on reads.java.lang.StringgetLockAttribute()DatabaseMappinggetMappingForAttributeName(java.lang.String name)Return the mapping for the specified attribute name.DatabaseMappinggetMappingForField(DatabaseField field)Return al the mapping for the specified field.protected java.util.Map<java.lang.String,DatabaseMapping>getMappingsByAttribute()Return all the mapping to attribute associationsjava.util.Map<DatabaseField,DatabaseMapping>getMappingsByField()INTERNAL: Return all the mapping to field associationsprotected java.util.List<DatabaseMapping>getNonPrimaryKeyMappings()Return the non primary key mappings.java.lang.ObjectgetParentObjectForField(DatabaseField databaseField, java.lang.Object domainObject)Return the base value that is mapped to for given field.java.util.List<java.lang.Class>getPrimaryKeyClassifications()Return primary key classifications.ExpressiongetPrimaryKeyExpression()Return the primary key expressionjava.util.List<DatabaseMapping>getPrimaryKeyMappings()Return primary key mappings.java.util.Map<DatabaseField,java.util.List<DatabaseMapping>>getReadOnlyMappingsByField()INTERNAL: Return all the read-only mapping to field associationsjava.util.List<DatabaseMapping>getReadOnlyMappingsForField(DatabaseField field)Return all the read-only mapping for the specified field.java.util.List<DatabaseMapping>getRelationshipMappings()PERF: Return all relationship mappings.AbstractDirectMappinggetSequenceMapping()PERF: Return the sequence mapping.DatabaseFieldgetTargetFieldForQueryKeyName(java.lang.String queryKeyName)INTERNAL: return a database field based on a query key namebooleanhasBatchFetchedAttributes()Return is any mappings are always batch fetched.booleanhasCacheIndexesInSopObject()booleanhasInBatchFetchedAttribute()Return is any mappings are always batch fetched using IN.booleanhasJoinedAttributes()Answers if any attributes are to be joined / returned in the same select statement.booleanhasWrapperPolicy()Return if the descriptor has a wrapper policy.protected voidinitialize(ClassDescriptor descriptor)voidinitialize(AbstractSession session)Cache all the mappings by their attribute and fields.voidinitializeBatchFetchedAttributes()INTERNAL: Iterates through all one to one mappings and checks if any of them use batch fetching.voidinitializeJoinedAttributes()INTERNAL: Iterates through all one to one mappings and checks if any of them use joining.voidinitializePrimaryKey(AbstractSession session)Cache primary key and non primary key mappings.java.lang.ObjectinstantiateClone(java.lang.Object domainObject, AbstractSession session)Returns the clone of the specified object.voidinstantiateEagerMappings(java.lang.Object object, AbstractSession session)Force instantiation to any eager mappings.java.lang.ObjectinstantiateWorkingCopyClone(java.lang.Object domainObject, AbstractSession session)Returns the clone of the specified object.java.lang.ObjectinstantiateWorkingCopyCloneFromRow(AbstractRecord row, ObjectBuildingQuery query, java.lang.Object primaryKey, UnitOfWorkImpl unitOfWork)It is now possible to build working copy clones directly from rows.booleanisPrimaryKeyComponentInvalid(java.lang.Object keyValue, int index)booleanisPrimaryKeyExpression(boolean requiresExactMatch, Expression expression, AbstractSession session)Return if the expression is by primary key.booleanisPrimaryKeyMapping(DatabaseMapping mapping)booleanisSimple()PERF: Return if the descriptor has no complex mappings, all direct.booleanisXMLObjectBuilder()voiditerate(DescriptorIterator iterator)INTERNAL: Perform the iteration operation on the objects attributes through the mappings.voidload(java.lang.Object object, AttributeGroup group, AbstractSession session, boolean fromFetchGroup)Force instantiation to any mappings in the load group.voidloadAll(java.lang.Object object, AbstractSession session)Force instantiation of all indirections.voidloadAll(java.lang.Object object, AbstractSession session, IdentityHashSet loaded)protected voidloadBatchReadAttributes(ClassDescriptor concreteDescriptor, java.lang.Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, boolean isTargetProtected)protected voidloadJoinedAttributes(ClassDescriptor concreteDescriptor, java.lang.Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, JoinedAttributeManager joinManager, ObjectBuildingQuery query, boolean isTargetProtected)voidmergeChangesIntoObject(java.lang.Object target, ObjectChangeSet changeSet, java.lang.Object source, MergeManager mergeManager, AbstractSession targetSession)INTERNAL: Merge changes between the objects, this merge algorithm is dependent on the merge manager.voidmergeChangesIntoObject(java.lang.Object target, ObjectChangeSet changeSet, java.lang.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.voidmergeIntoObject(java.lang.Object target, boolean isUnInitialized, java.lang.Object source, MergeManager mergeManager, AbstractSession targetSession)INTERNAL: Merge the contents of one object into another, this merge algorithm is dependent on the merge manager.voidmergeIntoObject(java.lang.Object target, ObjectChangeSet changeSet, boolean isUnInitialized, java.lang.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.voidpopulateAttributesForClone(java.lang.Object original, CacheKey cacheKey, java.lang.Object clone, java.lang.Integer refreshCascade, AbstractSession cloningSession)Clones the attributes of the specified object.protected voidpostBuildAttributesIntoObjectEvent(java.lang.Object domainObject, AbstractRecord databaseRow, ObjectBuildingQuery query, boolean forRefresh)protected voidpostBuildAttributesIntoWorkingCopyCloneEvent(java.lang.Object clone, AbstractRecord databaseRow, ObjectBuildingQuery query, UnitOfWorkImpl unitOfWork, boolean forRefresh)voidpostInitialize(AbstractSession session)INTERNAL: Post initializations after mappings are initialized.voidrecordPrivateOwnedRemovals(java.lang.Object object, UnitOfWorkImpl uow, boolean initialPass)protected booleanrefreshObjectIfRequired(ClassDescriptor concreteDescriptor, CacheKey cacheKey, java.lang.Object domainObject, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session, boolean targetIsProtected)This method is called when a cached Entity needs to be refreshedvoidrehashFieldDependancies(AbstractSession session)Rehash any maps based on fields.voidsetDescriptor(ClassDescriptor aDescriptor)Set the descriptor.protected voidsetFieldsMap(java.util.Map fieldsMap)Return the fields map.voidsetHasInBatchFetchedAttribute(boolean hasInBatchFetchedAttribute)Set if any mappings are always batch fetched using IN.voidsetHasWrapperPolicy(boolean hasWrapperPolicy)Set if the descriptor has a wrapper policy.protected voidsetMappingsByAttribute(java.util.Map<java.lang.String,DatabaseMapping> theAttributeMappings)All the mappings and their respective attribute associations are cached for performance improvement.voidsetMappingsByField(java.util.Map<DatabaseField,DatabaseMapping> theFieldMappings)INTERNAL: All the mappings and their respective field associations are cached for performance improvement.protected voidsetNonPrimaryKeyMappings(java.util.List<DatabaseMapping> theNonPrimaryKeyMappings)The non primary key mappings are cached to improve performance.voidsetPrimaryKeyClassifications(java.util.List<java.lang.Class> primaryKeyClassifications)INTERNAL: Set primary key classifications.voidsetPrimaryKeyExpression(Expression criteria)The primary key expression is cached to improve performance.protected voidsetPrimaryKeyMappings(java.util.List<DatabaseMapping> thePrimaryKeyMappings)The primary key mappings are cached to improve performance.voidsetReadOnlyMappingsByField(java.util.Map<DatabaseField,java.util.List<DatabaseMapping>> theReadOnlyFieldMappings)INTERNAL: All the read-only mappings and their respective field associations are cached for performance improvement.voidsetSequenceMapping(AbstractDirectMapping sequenceMapping)PERF: Set the sequence mapping.booleanshouldKeepRow()java.lang.StringtoString()voidtrimFieldsForInsert(AbstractSession session, AbstractRecord databaseRow)INTERNAL Remove a potential sequence number field and invoke the ReturningPolicy trimModifyRowsForInsert methodjava.lang.ObjectunwrapObject(java.lang.Object proxy, AbstractSession session)Unwrap the object if required.voidupdateCachedAttributes(PersistenceEntity persistenceEntity, CacheKey cacheKey, java.lang.Object primaryKey)INTERNAL: Used to updated any attributes that may be cached on a woven entityvoidvalidate(AbstractSession session)Validates the object builder.booleanverifyDelete(java.lang.Object object, AbstractSession session)Verify that an object has been deleted from the database.java.lang.ObjectwrapObject(java.lang.Object implementation, AbstractSession session)Wrap the object if required.AbstractRecordwriteIntoRowFromPrimaryKeyValues(AbstractRecord row, java.lang.Object primaryKey, AbstractSession session, boolean convert)Build the row from the primary key values.
-
-
-
Field Detail
-
descriptor
protected ClassDescriptor descriptor
-
mappingsByAttribute
protected java.util.Map<java.lang.String,DatabaseMapping> mappingsByAttribute
Mappings keyed by attribute name.
-
mappingsByField
protected java.util.Map<DatabaseField,DatabaseMapping> mappingsByField
Mappings keyed by database field.
-
readOnlyMappingsByField
protected java.util.Map<DatabaseField,java.util.List<DatabaseMapping>> readOnlyMappingsByField
List of read-only mappings using a database field.
-
fieldsMap
protected java.util.Map<DatabaseField,DatabaseField> fieldsMap
Used to maintain identity on the field objects. Ensure they get the correct index/type.
-
primaryKeyMappings
protected java.util.List<DatabaseMapping> primaryKeyMappings
Mapping for the primary key fields.
-
primaryKeyClassifications
protected java.util.List<java.lang.Class> primaryKeyClassifications
The types for the primary key fields, in same order as descriptor's primary key fields.
-
nonPrimaryKeyMappings
protected transient java.util.List<DatabaseMapping> nonPrimaryKeyMappings
All mapping other than primary key mappings.
-
primaryKeyExpression
protected transient Expression primaryKeyExpression
Expression for querying an object by primary key.
-
joinedAttributes
protected java.util.List<DatabaseMapping> joinedAttributes
PERF: Cache mapping that use joining.
-
batchFetchedAttributes
protected java.util.List<DatabaseMapping> batchFetchedAttributes
PERF: Cache mapping that use batch fetching.
-
hasInBatchFetchedAttribute
protected boolean hasInBatchFetchedAttribute
PERF: Cache mapping that use batch fetching.
-
cloningMappings
protected java.util.List<DatabaseMapping> cloningMappings
PERF: Cache mappings that require cloning.
-
eagerMappings
protected java.util.List<DatabaseMapping> eagerMappings
PERF: Cache mappings that are eager loaded.
-
relationshipMappings
protected java.util.List<DatabaseMapping> relationshipMappings
PERF: Cache relationship mappings.
-
isSimple
protected boolean isSimple
PERF: Cache if is a simple mapping, all direct.
-
hasWrapperPolicy
protected boolean hasWrapperPolicy
PERF: Cache if has a wrapper policy.
-
sequenceMapping
protected AbstractDirectMapping sequenceMapping
PERF: Cache sequence mappings.
-
mayHaveNullInPrimaryKey
protected boolean mayHaveNullInPrimaryKey
indicates whether part of primary key is unmapped - may happen only in case AggregateObject or AggregateCollection descriptor.
-
lockAttribute
protected java.lang.String lockAttribute
attribute name corresponding to optimistic lock field, set only if optimistic locking is used
-
shouldKeepRow
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. Used by ObjectLevelReadQuery ResultSetAccessOptimization.
-
hasCacheIndexesInSopObject
protected boolean hasCacheIndexesInSopObject
PERF: is there an cache index field that's would not be selected by SOP query. Ignored unless descriptor uses SOP and CachePolicy has cache indexes.
-
-
Constructor Detail
-
ObjectBuilder
public ObjectBuilder(ClassDescriptor descriptor)
-
-
Method Detail
-
initialize
protected void initialize(ClassDescriptor descriptor)
-
createRecord
public AbstractRecord createRecord(AbstractSession session)
Create a new row/record for the object builder. This allows subclasses to define different record types.- Specified by:
createRecordin classCoreObjectBuilder<AbstractRecord,AbstractSession,DatabaseField,DatabaseMapping>
-
createRecord
public AbstractRecord createRecord(int size, AbstractSession session)
Create a new row/record for the object builder. This allows subclasses to define different record types.
-
createRecordForPKExtraction
protected AbstractRecord createRecordForPKExtraction(int size, AbstractSession session)
Create a new row/record for the object builder. This allows subclasses to define different record types. This will typically be called when a record will be used for temporarily holding on to primary key fields.
-
addPrimaryKeyForNonDefaultTable
public void addPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow)
Add the primary key and its value to the Record for all the non default tables. This method is used while writing into the multiple tables.
-
addPrimaryKeyForNonDefaultTable
public void addPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow, java.lang.Object object, AbstractSession session)
Add the primary key and its value to the Record for all the non default tables. This method is used while writing into the multiple tables.
-
clearPrimaryKey
public void clearPrimaryKey(java.lang.Object object)
Clear any primary key cache data in the object.
-
assignReturnRow
public void assignReturnRow(java.lang.Object object, AbstractSession writeSession, AbstractRecord row, ObjectChangeSet changeSet) throws DatabaseExceptionAssign the fields in the row back into the object. This is used by returning, as well as events and version locking. If not null changeSet must correspond to object. changeSet is updated with all of the field values in the row.- Throws:
DatabaseException
-
assignReturnValueForField
public void assignReturnValueForField(java.lang.Object object, ReadObjectQuery query, AbstractRecord row, DatabaseField field, java.util.Collection handledMappings, ObjectChangeSet changeSet)Assign the field value from the row to the object for all the mappings using field (read or write). If not null changeSet must correspond to object. changeSet is updated with all of the field values in the row.
-
assignReturnValueToMapping
protected void assignReturnValueToMapping(java.lang.Object object, ReadObjectQuery query, AbstractRecord row, DatabaseField field, DatabaseMapping mapping, java.util.Collection handledMappings, ObjectChangeSet changeSet)INTERNAL: Assign values from objectRow to the object through the mapping. If not null changeSet must correspond to object. changeSet is updated with all of the field values in the row.
-
assignSequenceNumber
public java.lang.Object assignSequenceNumber(java.lang.Object object, AbstractSession writeSession) throws DatabaseExceptionINTERNAL: Update the object primary key by fetching a new sequence number from the accessor. This assume the uses sequence numbers check has already been done.- Returns:
- the sequence value or null if not assigned.
- Throws:
DatabaseException- - an error has occurred on the database.
-
assignSequenceNumber
public java.lang.Object assignSequenceNumber(WriteObjectQuery writeQuery) throws DatabaseException
INTERNAL: Update the writeQuery's object primary key by fetching a new sequence number from the accessor. This assume the uses sequence numbers check has already been done. Adds the assigned sequence value to writeQuery's modify row. If object has a changeSet then sets sequence value into change set as an Id adds it also to object's change set in a ChangeRecord if required.- Returns:
- the sequence value or null if not assigned.
- Throws:
DatabaseException- - an error has occurred on the database.
-
assignSequenceNumber
public java.lang.Object assignSequenceNumber(WriteObjectQuery writeQuery, java.lang.Object sequenceValue) throws DatabaseException
INTERNAL: Update the writeQuery's object primary key by fetching a new sequence number from the accessor. This assume the uses sequence numbers check has already been done. Adds the assigned sequence value to writeQuery's modify row. If object has a changeSet then sets sequence value into change set as an Id adds it also to object's change set in a ChangeRecord if required.- Returns:
- the sequence value or null if not assigned.
- Throws:
DatabaseException- - an error has occurred on the database.
-
assignSequenceNumber
protected java.lang.Object assignSequenceNumber(java.lang.Object object, java.lang.Object sequenceValue, AbstractSession writeSession, WriteObjectQuery writeQuery) throws DatabaseExceptionINTERNAL: Update the object primary key by fetching a new sequence number from the accessor. This assume the uses sequence numbers check has already been done. Adds the assigned sequence value to writeQuery's modify row. If object has a changeSet then sets sequence value into change set as an Id adds it also to object's change set in a ChangeRecord if required.- Returns:
- the sequence value or null if not assigned.
- Throws:
DatabaseException- - an error has occurred on the database.
-
buildAttributesIntoObject
public void buildAttributesIntoObject(java.lang.Object domainObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, FetchGroup executionFetchGroup, boolean forRefresh, AbstractSession targetSession) throws DatabaseExceptionEach mapping is recursed to assign values from the Record to the attributes in the domain object.- Throws:
DatabaseException
-
buildAttributesIntoObjectSOP
protected boolean buildAttributesIntoObjectSOP(java.lang.Object domainObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, FetchGroup executionFetchGroup, boolean forRefresh, AbstractSession targetSession) throws DatabaseExceptionEach mapping is recursed to assign values from the Record to the attributes in the domain object. Should not be called unless (this.descriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) This method populates the object only in if some mappings potentially should be read using sopObject and other mappings - not using it. That happens when the row has been just read from the database and potentially has serialized object still in deserialized bits as a field value. Note that domainObject == sopObject is the same case, but (because domainObject has to be set into cache beforehand) extraction of sopObject from bit was done right before this method is called. Alternative situation is processing an empty row that has been created by foreign reference mapping and holds nothing but sopObject (which is an attribute of the original sopObject) - this case falls through to buildAttributesIntoObject. If attempt to deserialize sopObject from bits has failed, but SOP was setup to allow recovery (all mapped all fields/value mapped to the object were read, not just those excluded from SOP) then fall through to buildAttributesIntoObject. Nothing should be done if sopObject is not null, but domainObject != sopObject: the only way to get into this case should be with original query not maintaining cache, through a back reference to the original object, which is already being built (or has been built).- Returns:
- whether the object has been populated with attributes, if not then buildAttributesIntoObject should be called.
- Throws:
DatabaseException
-
postBuildAttributesIntoObjectEvent
protected void postBuildAttributesIntoObjectEvent(java.lang.Object domainObject, AbstractRecord databaseRow, ObjectBuildingQuery query, boolean forRefresh)
-
buildBackupClone
public java.lang.Object buildBackupClone(java.lang.Object clone, UnitOfWorkImpl unitOfWork)Returns the backup clone of the specified object. This is called only from unit of work. The clone sent as parameter is always a working copy from the unit of work.
-
buildDeleteExpression
public Expression buildDeleteExpression(DatabaseTable table, AbstractRecord row, boolean usesOptimisticLocking)
Build and return the expression to use as the where clause to delete an object. The row is passed to allow the version number to be extracted from it. If called with usesOptimisticLocking==true the caller should make sure that descriptor uses optimistic locking policy.
-
buildExpressionFromExample
public Expression buildExpressionFromExample(java.lang.Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, java.util.Map processedObjects, AbstractSession session)
INTERNAL: This method is used when Query By Example is used. Going through the mappings one by one, this method calls the specific buildExpression method corresponding to the type of mapping. It then generates a complete Expression by joining the individual Expressions.
-
buildNewInstance
public java.lang.Object buildNewInstance()
Return a new instance of the receiver's javaClass.- Specified by:
buildNewInstancein classCoreObjectBuilder<AbstractRecord,AbstractSession,DatabaseField,DatabaseMapping>
-
buildObject
public java.lang.Object buildObject(ObjectLevelReadQuery query, AbstractRecord databaseRow)
Return an instance of the receivers javaClass. Set the attributes of an instance from the values stored in the database row.
-
buildObject
public java.lang.Object buildObject(ObjectBuildingQuery query, AbstractRecord databaseRow, JoinedAttributeManager joinManager)
Return an instance of the receivers javaClass. Set the attributes of an instance from the values stored in the database row.
-
buildObject
public java.lang.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. Set the attributes of an instance from the values stored in the database row. This is wrapper method with semaphore logic.
-
instantiateEagerMappings
public void instantiateEagerMappings(java.lang.Object object, AbstractSession session)Force instantiation to any eager mappings.
-
load
public void load(java.lang.Object object, AttributeGroup group, AbstractSession session, boolean fromFetchGroup)Force instantiation to any mappings in the load group.
-
loadAll
public void loadAll(java.lang.Object object, AbstractSession session)Force instantiation of all indirections.
-
loadAll
public void loadAll(java.lang.Object object, AbstractSession session, IdentityHashSet loaded)
-
buildObjectInUnitOfWork
protected java.lang.Object buildObjectInUnitOfWork(ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, java.lang.Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor) throws DatabaseException, QueryException
For executing all reads on the UnitOfWork, the session when building objects from rows will now be the UnitOfWork. Useful if the rows were read via a dirty write connection and we want to avoid putting uncommitted data in the global cache.Decides whether to call either buildWorkingCopyCloneFromRow (bypassing shared cache) or buildWorkingCopyCloneNormally (placing the result in the shared cache).
- Throws:
DatabaseExceptionQueryException
-
buildWorkingCopyCloneNormally
protected java.lang.Object buildWorkingCopyCloneNormally(ObjectBuildingQuery query, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, java.lang.Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager) throws DatabaseException, QueryException
buildWorkingCopyCloneFromRow is an alternative to this which is the normal behavior. A row is read from the database, an original is built/refreshed/returned from the shared cache, and the original is registered/conformed/reverted in the UnitOfWork.This default behavior is only safe when the query is executed on a read connection, otherwise uncommitted data might get loaded into the shared cache.
Represents the way TopLink has always worked.
- Throws:
DatabaseExceptionQueryException
-
buildObject
protected java.lang.Object buildObject(boolean returnCacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, java.lang.Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager) throws DatabaseException, QueryExceptionReturn an instance of the receivers javaClass. Set the attributes of an instance from the values stored in the database row.- Throws:
DatabaseExceptionQueryException
-
buildProtectedObject
protected java.lang.Object buildProtectedObject(boolean returnCacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, java.lang.Object primaryKey, CacheKey preFetchedCacheKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager) throws DatabaseException, QueryExceptionReturn an instance of the receivers javaClass. Set the attributes of an instance from the values stored in the database row.- Throws:
DatabaseExceptionQueryException
-
buildObjectsInto
public java.lang.Object buildObjectsInto(ReadAllQuery query, java.util.List databaseRows, java.lang.Object domainObjects)
Return a container which contains the instances of the receivers javaClass. Set the fields of the instance to the values stored in the database rows.
-
buildObjectsFromResultSetInto
public java.lang.Object buildObjectsFromResultSetInto(ReadAllQuery query, java.sql.ResultSet resultSet, java.util.Vector fields, DatabaseField[] fieldsArray, java.lang.Object domainObjects) throws java.sql.SQLException
Version of buildObjectsInto method that takes call instead of rows. Return a container which contains the instances of the receivers javaClass. Set the fields of the instance to the values stored in the result set.- Throws:
java.sql.SQLException
-
buildObjectsFromCursorInto
public java.lang.Object buildObjectsFromCursorInto(ReadAllQuery query, java.util.List databaseRows, java.lang.Object domainObjects)
Return a container which contains the instances of the receivers javaClass. Set the fields of the instance to the values stored in the database rows.
-
buildPrimaryKeyExpression
public Expression buildPrimaryKeyExpression(DatabaseTable table) throws DescriptorException
Build the primary key expression for the secondary table.- Throws:
DescriptorException
-
buildPrimaryKeyExpressionFromKeys
public Expression buildPrimaryKeyExpressionFromKeys(java.lang.Object primaryKey, AbstractSession session)
Build the primary key expression from the specified primary key values.
-
buildPrimaryKeyExpressionFromObject
public Expression buildPrimaryKeyExpressionFromObject(java.lang.Object domainObject, AbstractSession session)
Build the primary key expression from the specified domain object.
-
buildRow
public AbstractRecord buildRow(java.lang.Object object, AbstractSession session, DatabaseMapping.WriteType writeType)
Build the row representation of an object.
-
buildRow
public AbstractRecord buildRow(AbstractRecord databaseRow, java.lang.Object object, AbstractSession session, DatabaseMapping.WriteType writeType)
Build the row representation of an object.
-
buildRowForShallowInsert
public AbstractRecord buildRowForShallowInsert(java.lang.Object object, AbstractSession session)
Build the row representation of the object for update. The row built does not contain entries for uninstantiated attributes.
-
buildRowForShallowInsert
public AbstractRecord buildRowForShallowInsert(AbstractRecord databaseRow, java.lang.Object object, AbstractSession session)
Build the row representation of the object for update. The row built does not contain entries for uninstantiated attributes.
-
buildRowForUpdateAfterShallowInsert
public AbstractRecord buildRowForUpdateAfterShallowInsert(java.lang.Object object, AbstractSession session, DatabaseTable table)
Build the row representation of the object that contains only the fields nullified by shallow insert.
-
buildRowForUpdateAfterShallowInsert
public AbstractRecord buildRowForUpdateAfterShallowInsert(AbstractRecord databaseRow, java.lang.Object object, AbstractSession session, DatabaseTable table)
Build the row representation of the object that contains only the fields nullified by shallow insert.
-
buildRowForUpdateBeforeShallowDelete
public AbstractRecord buildRowForUpdateBeforeShallowDelete(java.lang.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.
-
buildRowForUpdateBeforeShallowDelete
public AbstractRecord buildRowForUpdateBeforeShallowDelete(AbstractRecord databaseRow, java.lang.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.
-
buildRowWithChangeSet
public AbstractRecord buildRowWithChangeSet(AbstractRecord databaseRow, ObjectChangeSet objectChangeSet, AbstractSession session, DatabaseMapping.WriteType writeType)
Build the row representation of an object. This is only used for aggregates.
-
buildRowForTranslation
public AbstractRecord buildRowForTranslation(java.lang.Object object, AbstractSession session)
Build the row representation of an object. The row built is used only for translations for the expressions in the expression framework.
-
buildRowForUpdate
public AbstractRecord buildRowForUpdate(WriteObjectQuery query)
Build the row representation of the object for update. The row built does not contain entries for unchanged attributes.
-
buildRowForUpdate
public AbstractRecord buildRowForUpdate(AbstractRecord databaseRow, WriteObjectQuery query)
Build into the row representation of the object for update. The row does not contain entries for unchanged attributes.
-
buildRowForUpdateWithChangeSet
public AbstractRecord buildRowForUpdateWithChangeSet(WriteObjectQuery query)
Build the row representation of the object for update. The row built does not contain entries for uninstantiated attributes.
-
buildRowForWhereClause
public AbstractRecord buildRowForWhereClause(ObjectLevelModifyQuery query)
Build the row representation of an object.
-
writeIntoRowFromPrimaryKeyValues
public AbstractRecord writeIntoRowFromPrimaryKeyValues(AbstractRecord row, java.lang.Object primaryKey, AbstractSession session, boolean convert)
Build the row from the primary key values.
-
buildRowFromPrimaryKeyValues
public AbstractRecord buildRowFromPrimaryKeyValues(java.lang.Object key, AbstractSession session)
Build the row from the primary key values.
-
buildTemplateInsertRow
public AbstractRecord buildTemplateInsertRow(AbstractSession session)
Build the row of all of the fields used for insertion.
-
buildTemplateInsertRow
public void buildTemplateInsertRow(AbstractSession session, AbstractRecord databaseRow)
-
trimFieldsForInsert
public void trimFieldsForInsert(AbstractSession session, AbstractRecord databaseRow)
INTERNAL Remove a potential sequence number field and invoke the ReturningPolicy trimModifyRowsForInsert method
-
buildTemplateUpdateRow
public AbstractRecord buildTemplateUpdateRow(AbstractSession session)
Build the row representation of the object for update. The row built does not contain entries for uninstantiated attributes.
-
buildUpdateExpression
public Expression buildUpdateExpression(DatabaseTable table, AbstractRecord transactionRow, AbstractRecord modifyRow)
Build and return the expression to use as the where clause to an update object. The row is passed to allow the version number to be extracted from it.
-
buildPrimaryKeyAttributesIntoObject
public void buildPrimaryKeyAttributesIntoObject(java.lang.Object original, AbstractRecord databaseRow, ObjectBuildingQuery query, AbstractSession session) throws DatabaseException, QueryExceptionINTERNAL: Build just the primary key mappings into the object.- Throws:
DatabaseExceptionQueryException
-
buildAttributesIntoShallowObject
public void buildAttributesIntoShallowObject(java.lang.Object original, AbstractRecord databaseRow, ObjectBuildingQuery query) throws DatabaseException, QueryExceptionINTERNAL: 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.- Throws:
DatabaseExceptionQueryException
-
buildAttributesIntoWorkingCopyClone
public void buildAttributesIntoWorkingCopyClone(java.lang.Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, boolean forRefresh) throws DatabaseException, QueryExceptionINTERNAL: For reading through the write connection when in transaction, populate the clone directly from the database row.- Throws:
DatabaseExceptionQueryException
-
buildAttributesIntoWorkingCopyCloneSOP
protected boolean buildAttributesIntoWorkingCopyCloneSOP(java.lang.Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, boolean forRefresh) throws DatabaseExceptionFor reading through the write connection when in transaction, populate the clone directly from the database row. Should not be called unless (this.descriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) This method populates the object only in if some mappings potentially should be read using sopObject and other mappings - not using it. That happens when the row has been just read from the database and potentially has serialized object still in deserialized bits as a field value. Note that clone == sopObject is the same case, but (because clone has to be set into cache beforehand) extraction of sopObject from bit was done right before this method is called. If attempt to deserialize sopObject from bits has failed, but SOP was setup to allow recovery (all mapped all fields/value mapped to the object were read, not just those excluded from SOP) then fall through to buildAttributesIntoWorkingCopyClone. Nothing should be done if sopObject is not null, but clone != sopObject: the only way to get into this case should be with original query not maintaining cache, through a back reference to the original object, which is already being built (or has been built).- Returns:
- whether the object has been populated with attributes, if not then buildAttributesIntoWorkingCopyClone should be called.
- Throws:
DatabaseException
-
postBuildAttributesIntoWorkingCopyCloneEvent
protected void postBuildAttributesIntoWorkingCopyCloneEvent(java.lang.Object clone, AbstractRecord databaseRow, ObjectBuildingQuery query, UnitOfWorkImpl unitOfWork, boolean forRefresh)
-
buildWorkingCopyCloneFromRow
protected java.lang.Object buildWorkingCopyCloneFromRow(ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, java.lang.Object primaryKey, CacheKey preFetchedCacheKey) throws DatabaseException, QueryException
INTERNAL: Builds a working copy clone directly from the database row. This is the key method that allows us to execute queries against a UnitOfWork while in transaction and not cache the results in the shared cache. This is because we might violate transaction isolation by putting uncommitted versions of objects in the shared cache.- Throws:
DatabaseExceptionQueryException
-
buildObjectFromResultSet
public java.lang.Object buildObjectFromResultSet(ObjectBuildingQuery query, JoinedAttributeManager joinManager, java.sql.ResultSet resultSet, AbstractSession executionSession, DatabaseAccessor accessor, java.sql.ResultSetMetaData metaData, DatabasePlatform platform, java.util.Vector fieldsList, DatabaseField[] fieldsArray) throws java.sql.SQLException
INTERNAL: Builds a working copy clone directly from a result set. PERF: This method is optimized for a specific case of building objects so can avoid many of the normal checks, only queries that have this criteria can use this method of building objects. This is wrapper method with semaphore logic.- Throws:
java.sql.SQLException
-
clone
public java.lang.Object clone()
Returns a clone of itself.- Overrides:
clonein classjava.lang.Object
-
cascadePerformRemove
public void cascadePerformRemove(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map visitedObjects)INTERNAL: This method is used by the UnitOfWork to cascade registration of new objects. It may raise exceptions as described in the EJB3 specification
-
cascadePerformRemovePrivateOwnedObjectFromChangeSet
public void cascadePerformRemovePrivateOwnedObjectFromChangeSet(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map 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.
-
cacheForeignKeyValues
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. This is used when the mapping is protected but we have retrieved the fk values and will cache them for use when the entity is cloned.
-
cacheForeignKeyValues
public void cacheForeignKeyValues(java.lang.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. This is used when the mapping is protected but we have retrieved the fk values and will cache them for use when the entity is cloned.
-
cascadeDiscoverAndPersistUnregisteredNewObjects
public void cascadeDiscoverAndPersistUnregisteredNewObjects(java.lang.Object object, java.util.Map newObjects, java.util.Map unregisteredExistingObjects, java.util.Map visitedObjects, UnitOfWorkImpl uow, java.util.Set cascadeErrors)INTERNAL: Cascade discover and persist new objects during commit. It may raise exceptions as described in the EJB3 specification
-
cascadeRegisterNewForCreate
public void cascadeRegisterNewForCreate(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map visitedObjects)INTERNAL: This method is used by the UnitOfWork to cascade registration of new objects. It may raise exceptions as described in the EJB3 specification
-
compareForChange
public ObjectChangeSet compareForChange(java.lang.Object clone, java.lang.Object backUp, UnitOfWorkChangeSet changeSet, AbstractSession session)
INTERNAL: This method creates a records change set for a particular object. It should only be used by aggregates.- Returns:
- ObjectChangeSet
-
compareObjects
public boolean compareObjects(java.lang.Object firstObject, java.lang.Object secondObject, AbstractSession session)Compares the two specified objects
-
copyInto
public void copyInto(java.lang.Object source, java.lang.Object target, boolean cloneOneToOneValueHolders)Copy each attribute from one object into the other.
-
copyInto
public void copyInto(java.lang.Object source, java.lang.Object target)Copy each attribute from one object into the other.
-
copyObject
public java.lang.Object copyObject(java.lang.Object original, CopyGroup copyGroup)Return a copy of the object. This is NOT used for unit of work but for templatizing an object. The depth and primary key reseting are passed in.
-
createObjectChangeSet
public ObjectChangeSet createObjectChangeSet(java.lang.Object clone, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)
INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.- Parameters:
clone- the object to convert to a changeSet.uowChangeSet- the owner of this changeSet.- Returns:
- ObjectChangeSet the newly created changeSet representing the clone object
-
createObjectChangeSet
public ObjectChangeSet createObjectChangeSet(java.lang.Object clone, UnitOfWorkChangeSet uowChangeSet, boolean isNew, AbstractSession session)
INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.- Parameters:
clone- the object to convert to a changeSet.uowChangeSet- the owner of this changeSet.isNew- signifies if the clone object is a new object.- Returns:
- ObjectChangeSet the newly created changeSet representing the clone object
-
createObjectChangeSet
public ObjectChangeSet createObjectChangeSet(java.lang.Object clone, UnitOfWorkChangeSet uowChangeSet, boolean isNew, boolean assignPrimaryKeyIfExisting, AbstractSession session)
INTERNAL: Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object.- Parameters:
clone- the object to convert to a changeSet.uowChangeSet- the owner of this changeSet.isNew- signifies if the clone object is a new object.assignPrimaryKeyIfExisting- signifies if the primary key of the change set should be updated if existing.- Returns:
- ObjectChangeSet the newly created changeSet representing the clone object
-
createPrimaryKeyExpression
public void createPrimaryKeyExpression(AbstractSession session)
Creates and stores primary key expression.
-
extractPrimaryKeyFromExpression
public java.lang.Object extractPrimaryKeyFromExpression(boolean requiresExactMatch, Expression expression, AbstractRecord translationRow, AbstractSession session)Return the row with primary keys and their values from the given expression.
-
isPrimaryKeyExpression
public boolean isPrimaryKeyExpression(boolean requiresExactMatch, Expression expression, AbstractSession session)Return if the expression is by primary key.
-
extractPrimaryKeyFromObject
public java.lang.Object extractPrimaryKeyFromObject(java.lang.Object domainObject, AbstractSession session)Extract primary key attribute values from the domainObject.- Specified by:
extractPrimaryKeyFromObjectin classCoreObjectBuilder<AbstractRecord,AbstractSession,DatabaseField,DatabaseMapping>
-
extractPrimaryKeyFromObject
public java.lang.Object extractPrimaryKeyFromObject(java.lang.Object domainObject, AbstractSession session, boolean shouldReturnNullIfNull)Extract primary key attribute values from the domainObject.
-
extractPrimaryKeyFromRow
public java.lang.Object extractPrimaryKeyFromRow(AbstractRecord databaseRow, AbstractSession session)
Extract primary key values from the specified row. null is returned if the row does not contain the key.
-
extractPrimaryKeyRowFromExpression
public AbstractRecord extractPrimaryKeyRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session)
Return the row with primary keys and their values from the given expression.
-
extractRowFromExpression
public AbstractRecord extractRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session)
Return the row from the given expression.
-
extractPrimaryKeyRowFromObject
public AbstractRecord extractPrimaryKeyRowFromObject(java.lang.Object domainObject, AbstractSession session)
Extract primary key attribute values from the domainObject.
-
extractValueFromObjectForField
public java.lang.Object extractValueFromObjectForField(java.lang.Object domainObject, DatabaseField field, AbstractSession session) throws DescriptorExceptionExtract the value of the primary key attribute from the specified object.- Throws:
DescriptorException
-
fixObjectReferences
public void fixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, DistributedSession session)INTERNAL: An object has been serialized from the server to the client. Replace the transient attributes of the remote value holders with client-side objects.
-
getBaseChangeRecordForField
public ChangeRecord getBaseChangeRecordForField(ObjectChangeSet objectChangeSet, java.lang.Object object, DatabaseField databaseField, AbstractSession session)
Return the base ChangeRecord for the given DatabaseField. The object and all its relevant aggregates must exist. The returned ChangeRecord is either DirectToFieldChangeRecord or TransformationMappingChangeRecord, or null.
-
getBaseMappingForField
public DatabaseMapping getBaseMappingForField(DatabaseField databaseField)
Return the base mapping for the given DatabaseField.
-
getBaseValueForField
public java.lang.Object getBaseValueForField(DatabaseField databaseField, java.lang.Object domainObject)
Return the base value that is mapped to for given field.
-
getDescriptor
public ClassDescriptor getDescriptor()
Return the descriptor
-
getFieldClassification
public java.lang.Class getFieldClassification(DatabaseField fieldToClassify) throws DescriptorException
INTERNAL: Return the classification for the field contained in the mapping. This is used to convert the row value to a consistent java value.- Throws:
DescriptorException
-
getFieldForQueryKeyName
public DatabaseField getFieldForQueryKeyName(java.lang.String name)
Return the field used for the query key name.
-
getFieldsMap
public java.util.Map<DatabaseField,DatabaseField> getFieldsMap()
Return the fields map. Used to maintain identity on the field objects. Ensure they get the correct index/type.
-
setFieldsMap
protected void setFieldsMap(java.util.Map fieldsMap)
Return the fields map. Used to maintain identity on the field objects. Ensure they get the correct index/type.
-
getCloningMappings
public java.util.List<DatabaseMapping> getCloningMappings()
PERF: Return all mappings that require cloning. This allows for simple directs to be avoided when using clone copying.
-
isSimple
public boolean isSimple()
PERF: Return if the descriptor has no complex mappings, all direct.
-
getRelationshipMappings
public java.util.List<DatabaseMapping> getRelationshipMappings()
PERF: Return all relationship mappings.
-
getEagerMappings
public java.util.List<DatabaseMapping> getEagerMappings()
PERF: Return all mappings that are eager loaded (but use indirection). This allows for eager mappings to still benefit from indirection for locking and change tracking.
-
getJoinedAttributes
public java.util.List<DatabaseMapping> getJoinedAttributes()
Answers the attributes which are always joined to the original query on reads.
-
getBatchFetchedAttributes
public java.util.List<DatabaseMapping> getBatchFetchedAttributes()
Return the mappings that are always batch fetched.
-
getSequenceMapping
public AbstractDirectMapping getSequenceMapping()
PERF: Return the sequence mapping.
-
setSequenceMapping
public void setSequenceMapping(AbstractDirectMapping sequenceMapping)
PERF: Set the sequence mapping.
-
hasJoinedAttributes
public boolean hasJoinedAttributes()
Answers if any attributes are to be joined / returned in the same select statement.
-
hasBatchFetchedAttributes
public boolean hasBatchFetchedAttributes()
Return is any mappings are always batch fetched.
-
hasInBatchFetchedAttribute
public boolean hasInBatchFetchedAttribute()
Return is any mappings are always batch fetched using IN.
-
setHasInBatchFetchedAttribute
public void setHasInBatchFetchedAttribute(boolean hasInBatchFetchedAttribute)
Set if any mappings are always batch fetched using IN.
-
getMappingForAttributeName
public DatabaseMapping getMappingForAttributeName(java.lang.String name)
Return the mapping for the specified attribute name.
-
getMappingForField
public DatabaseMapping getMappingForField(DatabaseField field)
Return al the mapping for the specified field.- Specified by:
getMappingForFieldin classCoreObjectBuilder<AbstractRecord,AbstractSession,DatabaseField,DatabaseMapping>
-
getReadOnlyMappingsForField
public java.util.List<DatabaseMapping> getReadOnlyMappingsForField(DatabaseField field)
Return all the read-only mapping for the specified field.
-
getMappingsByAttribute
protected java.util.Map<java.lang.String,DatabaseMapping> getMappingsByAttribute()
Return all the mapping to attribute associations
-
getMappingsByField
public java.util.Map<DatabaseField,DatabaseMapping> getMappingsByField()
INTERNAL: Return all the mapping to field associations
-
getReadOnlyMappingsByField
public java.util.Map<DatabaseField,java.util.List<DatabaseMapping>> getReadOnlyMappingsByField()
INTERNAL: Return all the read-only mapping to field associations
-
getNonPrimaryKeyMappings
protected java.util.List<DatabaseMapping> getNonPrimaryKeyMappings()
Return the non primary key mappings.
-
getParentObjectForField
public java.lang.Object getParentObjectForField(DatabaseField databaseField, java.lang.Object domainObject)
Return the base value that is mapped to for given field.
-
getPrimaryKeyClassifications
public java.util.List<java.lang.Class> getPrimaryKeyClassifications()
Return primary key classifications. These are used to ensure a consistent type for the pk values.
-
getPrimaryKeyExpression
public Expression getPrimaryKeyExpression()
Return the primary key expression
-
getPrimaryKeyMappings
public java.util.List<DatabaseMapping> getPrimaryKeyMappings()
Return primary key mappings.
-
getTargetFieldForQueryKeyName
public DatabaseField getTargetFieldForQueryKeyName(java.lang.String queryKeyName)
INTERNAL: return a database field based on a query key name
-
initialize
public void initialize(AbstractSession session) throws DescriptorException
Cache all the mappings by their attribute and fields.- Throws:
DescriptorException
-
isPrimaryKeyComponentInvalid
public boolean isPrimaryKeyComponentInvalid(java.lang.Object keyValue, int index)
-
recordPrivateOwnedRemovals
public void recordPrivateOwnedRemovals(java.lang.Object object, UnitOfWorkImpl uow, boolean initialPass)
-
postInitialize
public void postInitialize(AbstractSession session) throws DescriptorException
INTERNAL: Post initializations after mappings are initialized.- Throws:
DescriptorException
-
initializeJoinedAttributes
public void initializeJoinedAttributes()
INTERNAL: Iterates through all one to one mappings and checks if any of them use joining.By caching the result query execution in the case where there are no joined attributes can be improved.
-
initializeBatchFetchedAttributes
public void initializeBatchFetchedAttributes()
INTERNAL: Iterates through all one to one mappings and checks if any of them use batch fetching.By caching the result query execution in the case where there are no batch fetched attributes can be improved.
-
copyQueryInfoToCacheKey
protected void copyQueryInfoToCacheKey(CacheKey cacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, ClassDescriptor concreteDescriptor)
Initialize a cache key. Called by buildObject and now also by buildWorkingCopyCloneFromRow.
-
initializePrimaryKey
public void initializePrimaryKey(AbstractSession session) throws DescriptorException
Cache primary key and non primary key mappings.- Throws:
DescriptorException
-
instantiateClone
public java.lang.Object instantiateClone(java.lang.Object domainObject, AbstractSession session)Returns the clone of the specified object. This is called only from unit of work. This only instantiates the clone instance, it does not clone the attributes, this allows the stub of the clone to be registered before cloning its parts.
-
instantiateWorkingCopyClone
public java.lang.Object instantiateWorkingCopyClone(java.lang.Object domainObject, AbstractSession session)Returns the clone of the specified object. This is called only from unit of work. The domainObject sent as parameter is always a copy from the parent of unit of work. bug 2612602 make a call to build a working clone. This will in turn call the copy policy to make a working clone. This allows for lighter and heavier clones to be created based on their use. this allows the stub of the clone to be registered before cloning its parts.
-
instantiateWorkingCopyCloneFromRow
public java.lang.Object instantiateWorkingCopyCloneFromRow(AbstractRecord row, ObjectBuildingQuery query, java.lang.Object primaryKey, UnitOfWorkImpl unitOfWork)
It is now possible to build working copy clones directly from rows.An intermediary original is no longer needed.
This has ramifications to the copy policy and cmp, for clones are no longer built via cloning.
Instead the copy policy must in some cases not copy at all. this allows the stub of the clone to be registered before cloning its parts.
-
isPrimaryKeyMapping
public boolean isPrimaryKeyMapping(DatabaseMapping mapping)
-
iterate
public void iterate(DescriptorIterator iterator)
INTERNAL: Perform the iteration operation on the objects attributes through the mappings.
-
mergeChangesIntoObject
public void mergeChangesIntoObject(java.lang.Object target, ObjectChangeSet changeSet, java.lang.Object source, MergeManager mergeManager, AbstractSession targetSession)INTERNAL: Merge changes between the objects, this merge algorithm is dependent on the merge manager.
-
mergeChangesIntoObject
public void mergeChangesIntoObject(java.lang.Object target, ObjectChangeSet changeSet, java.lang.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.
-
mergeIntoObject
public void mergeIntoObject(java.lang.Object target, boolean isUnInitialized, java.lang.Object source, MergeManager mergeManager, AbstractSession targetSession)INTERNAL: Merge the contents of one object into another, this merge algorithm is dependent on the merge manager. This merge also prevents the extra step of calculating the changes when it is not required.
-
mergeIntoObject
public void mergeIntoObject(java.lang.Object target, ObjectChangeSet changeSet, boolean isUnInitialized, java.lang.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. This merge also prevents the extra step of calculating the changes when it is not required. If 'cascadeOnly' is true, only foreign reference mappings are merged. If 'isTargetCloneOfOriginal' then the target was create through a shallow clone of the source, so merge basics is not required.
-
populateAttributesForClone
public void populateAttributesForClone(java.lang.Object original, CacheKey cacheKey, java.lang.Object clone, java.lang.Integer refreshCascade, AbstractSession cloningSession)Clones the attributes of the specified object. This is called only from unit of work. The domainObject sent as parameter is always a copy from the parent of unit of work.
-
loadBatchReadAttributes
protected void loadBatchReadAttributes(ClassDescriptor concreteDescriptor, java.lang.Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, boolean isTargetProtected)
-
loadJoinedAttributes
protected void loadJoinedAttributes(ClassDescriptor concreteDescriptor, java.lang.Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, JoinedAttributeManager joinManager, ObjectBuildingQuery query, boolean isTargetProtected)
-
refreshObjectIfRequired
protected boolean refreshObjectIfRequired(ClassDescriptor concreteDescriptor, CacheKey cacheKey, java.lang.Object domainObject, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session, boolean targetIsProtected)
This method is called when a cached Entity needs to be refreshed
-
rehashFieldDependancies
public void rehashFieldDependancies(AbstractSession session)
Rehash any maps based on fields. This is used to clone descriptors for aggregates, which hammer field names, it is probably better not to hammer the field name and this should be refactored.
-
setDescriptor
public void setDescriptor(ClassDescriptor aDescriptor)
Set the descriptor.
-
setMappingsByAttribute
protected void setMappingsByAttribute(java.util.Map<java.lang.String,DatabaseMapping> theAttributeMappings)
All the mappings and their respective attribute associations are cached for performance improvement.
-
setMappingsByField
public void setMappingsByField(java.util.Map<DatabaseField,DatabaseMapping> theFieldMappings)
INTERNAL: All the mappings and their respective field associations are cached for performance improvement.
-
setReadOnlyMappingsByField
public void setReadOnlyMappingsByField(java.util.Map<DatabaseField,java.util.List<DatabaseMapping>> theReadOnlyFieldMappings)
INTERNAL: All the read-only mappings and their respective field associations are cached for performance improvement.
-
setNonPrimaryKeyMappings
protected void setNonPrimaryKeyMappings(java.util.List<DatabaseMapping> theNonPrimaryKeyMappings)
The non primary key mappings are cached to improve performance.
-
setPrimaryKeyClassifications
public void setPrimaryKeyClassifications(java.util.List<java.lang.Class> primaryKeyClassifications)
INTERNAL: Set primary key classifications. These are used to ensure a consistent type for the pk values.
-
setPrimaryKeyExpression
public void setPrimaryKeyExpression(Expression criteria)
The primary key expression is cached to improve performance.
-
setPrimaryKeyMappings
protected void setPrimaryKeyMappings(java.util.List<DatabaseMapping> thePrimaryKeyMappings)
The primary key mappings are cached to improve performance.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
unwrapObject
public java.lang.Object unwrapObject(java.lang.Object proxy, AbstractSession session)Unwrap the object if required. This is used for the wrapper policy support and EJB.
-
updateCachedAttributes
public void updateCachedAttributes(PersistenceEntity persistenceEntity, CacheKey cacheKey, java.lang.Object primaryKey)
INTERNAL: Used to updated any attributes that may be cached on a woven entity
-
validate
public void validate(AbstractSession session) throws DescriptorException
Validates the object builder. This is done once the object builder initialized and descriptor fires this validation.- Throws:
DescriptorException
-
verifyDelete
public boolean verifyDelete(java.lang.Object object, AbstractSession session)Verify that an object has been deleted from the database. An object can span multiple tables. A query is performed on each of these tables using the primary key values of the object as the selection criteria. If the query returns a result then the object has not been deleted from the database. If no result is returned then each of the mappings is asked to verify that the object has been deleted. If all mappings answer true then the result is true.
-
hasWrapperPolicy
public boolean hasWrapperPolicy()
Return if the descriptor has a wrapper policy. Cache for performance.
-
setHasWrapperPolicy
public void setHasWrapperPolicy(boolean hasWrapperPolicy)
Set if the descriptor has a wrapper policy. Cached for performance.
-
wrapObject
public java.lang.Object wrapObject(java.lang.Object implementation, AbstractSession session)Wrap the object if required. This is used for the wrapper policy support and EJB.
-
isXMLObjectBuilder
public boolean isXMLObjectBuilder()
-
getLockAttribute
public java.lang.String getLockAttribute()
-
shouldKeepRow
public boolean shouldKeepRow()
-
hasCacheIndexesInSopObject
public boolean hasCacheIndexesInSopObject()
-
createRecordFromXMLContext
public AbstractRecord createRecordFromXMLContext(XMLContext context)
Description copied from class:CoreObjectBuilderCreate a new row/record from XMLContext.- Specified by:
createRecordFromXMLContextin classCoreObjectBuilder<AbstractRecord,AbstractSession,DatabaseField,DatabaseMapping>
-
-