/** * 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. */ public void addPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow) { // this method has been revised so it calls addPrimaryKeyForNonDefaultTable(AbstractRecord, Object, Session) is similar. // the session and object are null in this case. addPrimaryKeyForNonDefaultTable(databaseRow, null, null); }
/** * 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. */ public void addPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow) { // this method has been revised so it calls addPrimaryKeyForNonDefaultTable(AbstractRecord, Object, Session) is similar. // the session and object are null in this case. addPrimaryKeyForNonDefaultTable(databaseRow, null, null); }
/** * 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. */ public void addPrimaryKeyForNonDefaultTable(AbstractRecord databaseRow) { // this method has been revised so it calls addPrimaryKeyForNonDefaultTable(AbstractRecord, Object, Session) is similar. // the session and object are null in this case. addPrimaryKeyForNonDefaultTable(databaseRow, null, null); }
/** * Build the row representation of an object. */ public AbstractRecord buildRowForWhereClause(ObjectLevelModifyQuery query) { AbstractRecord databaseRow = createRecord(query.getSession()); for (Iterator mappings = this.descriptor.getMappings().iterator(); mappings.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)mappings.next(); mapping.writeFromObjectIntoRowForWhereClause(query, databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow); } return databaseRow; }
/** * Build the row representation of an object. The row built is used only for translations * for the expressions in the expression framework. */ public AbstractRecord buildRowForTranslation(Object object, AbstractSession session) { AbstractRecord databaseRow = createRecord(session); List<DatabaseMapping> primaryKeyMappings = getPrimaryKeyMappings(); int size = primaryKeyMappings.size(); for (int index = 0; index < size; index++) { DatabaseMapping mapping = primaryKeyMappings.get(index); if (mapping != null) { mapping.writeFromObjectIntoRow(object, databaseRow, session, WriteType.UNDEFINED); } } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables, this is require for m-m, dc defined in the Builder that prefixes the wrong table name. // Ideally the mappings should take part in building the translation row so they can add required values. if (this.descriptor.hasMultipleTables()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } return databaseRow; }
/** * Build the row representation of an object. The row built is used only for translations * for the expressions in the expression framework. */ public AbstractRecord buildRowForTranslation(Object object, AbstractSession session) { AbstractRecord databaseRow = createRecord(session); List<DatabaseMapping> primaryKeyMappings = getPrimaryKeyMappings(); int size = primaryKeyMappings.size(); for (int index = 0; index < size; index++) { DatabaseMapping mapping = primaryKeyMappings.get(index); if (mapping != null) { mapping.writeFromObjectIntoRow(object, databaseRow, session, WriteType.UNDEFINED); } } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables, this is require for m-m, dc defined in the Builder that prefixes the wrong table name. // Ideally the mappings should take part in building the translation row so they can add required values. if (this.descriptor.hasMultipleTables()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } return databaseRow; }
/** * Build the row representation of an object. The row built is used only for translations * for the expressions in the expression framework. */ public AbstractRecord buildRowForTranslation(Object object, AbstractSession session) { AbstractRecord databaseRow = createRecord(session); List<DatabaseMapping> primaryKeyMappings = getPrimaryKeyMappings(); int size = primaryKeyMappings.size(); for (int index = 0; index < size; index++) { DatabaseMapping mapping = primaryKeyMappings.get(index); if (mapping != null) { mapping.writeFromObjectIntoRow(object, databaseRow, session); } } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables, this is require for m-m, dc defined in the Builder that prefixes the wrong table name. // Ideally the mappings should take part in building the translation row so they can add required values. if (this.descriptor.hasMultipleTables()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } return databaseRow; }
/** * Build the row representation of an object. */ public AbstractRecord buildRowForWhereClause(ObjectLevelModifyQuery query) { AbstractRecord databaseRow = createRecord(query.getSession()); // EL bug 319759 if (query.isUpdateObjectQuery()) { query.setShouldValidateUpdateCallCacheUse(true); } for (Iterator mappings = this.descriptor.getMappings().iterator(); mappings.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)mappings.next(); mapping.writeFromObjectIntoRowForWhereClause(query, databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow); } return databaseRow; }
/** * Build the row representation of an object. */ public AbstractRecord buildRowForWhereClause(ObjectLevelModifyQuery query) { AbstractRecord databaseRow = createRecord(query.getSession()); // EL bug 319759 if (query.isUpdateObjectQuery()) { query.setShouldValidateUpdateCallCacheUse(true); } for (Iterator mappings = this.descriptor.getMappings().iterator(); mappings.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)mappings.next(); mapping.writeFromObjectIntoRowForWhereClause(query, databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow); } return databaseRow; }
/** * Build the row representation of the object for update. The row built does not * contain entries for uninstantiated attributes. */ public AbstractRecord buildRowForShallowInsert(AbstractRecord databaseRow, Object object, AbstractSession session) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRowForShallowInsert(object, databaseRow, session); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } return databaseRow; }
/** * Build the row representation of an object. */ public AbstractRecord buildRow(AbstractRecord databaseRow, Object object, AbstractSession session) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRow(object, databaseRow, session); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (this.descriptor.hasMultipleTables() && !this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } return databaseRow; }
public void buildTemplateInsertRow(AbstractSession session, AbstractRecord databaseRow) { for (Iterator mappings = this.descriptor.getMappings().iterator(); mappings.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)mappings.next(); mapping.writeInsertFieldsIntoRow(databaseRow, session); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToInsertRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow); } if (this.descriptor.usesOptimisticLocking()) { this.descriptor.getOptimisticLockingPolicy().addLockFieldsToUpdateRow(databaseRow, session); } // remove any fields from the databaseRow trimFieldsForInsert(session, databaseRow); }
/** * Build the row representation of the object for update. The row built does not * contain entries for uninstantiated attributes. */ public AbstractRecord buildRowForShallowInsert(AbstractRecord databaseRow, Object object, AbstractSession session) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRowForShallowInsert(object, databaseRow, session); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; }
/** * Build the row representation of the object for update. The row built does not * contain entries for uninstantiated attributes. */ public AbstractRecord buildRowForShallowInsert(AbstractRecord databaseRow, Object object, AbstractSession session) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRowForShallowInsert(object, databaseRow, session); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; }
/** * Build the row representation of an object. */ public AbstractRecord buildRow(AbstractRecord databaseRow, Object object, AbstractSession session, WriteType writeType) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRow(object, databaseRow, session, writeType); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (this.descriptor.hasMultipleTables() && !this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; } /**
/** * Build the row representation of an object. */ public AbstractRecord buildRow(AbstractRecord databaseRow, Object object, AbstractSession session, WriteType writeType) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRow(object, databaseRow, session, writeType); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (this.descriptor.hasMultipleTables() && !this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; } /**
public void buildTemplateInsertRow(AbstractSession session, AbstractRecord databaseRow) { for (Iterator mappings = this.descriptor.getMappings().iterator(); mappings.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)mappings.next(); mapping.writeInsertFieldsIntoRow(databaseRow, session); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToInsertRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow); } if (this.descriptor.usesOptimisticLocking()) { this.descriptor.getOptimisticLockingPolicy().addLockFieldsToUpdateRow(databaseRow, session); } // If the session uses multi-tenancy, add the tenant id field. if (this.descriptor.hasMultitenantPolicy()) { this.descriptor.getMultitenantPolicy().addFieldsToRow(databaseRow, session); } if (this.descriptor.hasSerializedObjectPolicy()) { databaseRow.put(this.descriptor.getSerializedObjectPolicy().getField(), null); } // remove any fields from the databaseRow trimFieldsForInsert(session, databaseRow); }
getDescriptor().getObjectBuilder().addPrimaryKeyForNonDefaultTable(getModifyRow(), object, getSession());
objectBuilder.addPrimaryKeyForNonDefaultTable(modifyRow, object, session);