/** * Build the row representation of the object for update. The row built does not * contain entries for uninstantiated attributes. */ public AbstractRecord buildTemplateUpdateRow(AbstractSession session) { AbstractRecord databaseRow = createRecord(session); for (Iterator mappings = getNonPrimaryKeyMappings().iterator(); mappings.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)mappings.next(); mapping.writeUpdateFieldsIntoRow(databaseRow, session); } if (this.descriptor.usesOptimisticLocking()) { this.descriptor.getOptimisticLockingPolicy().addLockFieldsToUpdateRow(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 buildTemplateUpdateRow(AbstractSession session) { AbstractRecord databaseRow = createRecord(session); for (Iterator mappings = getNonPrimaryKeyMappings().iterator(); mappings.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)mappings.next(); mapping.writeUpdateFieldsIntoRow(databaseRow, session); } if (this.descriptor.usesOptimisticLocking()) { this.descriptor.getOptimisticLockingPolicy().addLockFieldsToUpdateRow(databaseRow, session); } if (this.descriptor.hasSerializedObjectPolicy()) { databaseRow.put(this.descriptor.getSerializedObjectPolicy().getField(), null); } return databaseRow; }
/** * Build the row representation of the object for update. The row built does not * contain entries for uninstantiated attributes. */ public AbstractRecord buildTemplateUpdateRow(AbstractSession session) { AbstractRecord databaseRow = createRecord(session); for (Iterator mappings = getNonPrimaryKeyMappings().iterator(); mappings.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)mappings.next(); mapping.writeUpdateFieldsIntoRow(databaseRow, session); } if (this.descriptor.usesOptimisticLocking()) { this.descriptor.getOptimisticLockingPolicy().addLockFieldsToUpdateRow(databaseRow, session); } if (this.descriptor.hasSerializedObjectPolicy()) { databaseRow.put(this.descriptor.getSerializedObjectPolicy().getField(), null); } 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); }
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); }
this.descriptor.getOptimisticLockingPolicy().addLockFieldsToUpdateRow(databaseRow, session);