/** * INTERNAL: * Get the appropriate attribute value from the object * and put it in the appropriate field of the database row. * Loop through the reference objects and extract the * primary keys and put them in the vector of "nested" rows. */ public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship()) { Object object = ((ObjectChangeSet)changeRecord.getOwner()).getUnitOfWorkClone(); this.writeFromObjectIntoRow(object, row, session); } else { super.writeFromObjectIntoRowWithChangeRecord(changeRecord, row, session); } }
/** * INTERNAL: * Get the appropriate attribute value from the object * and put it in the appropriate field of the database row. * Loop through the reference objects and extract the * primary keys and put them in the vector of "nested" rows. */ @Override public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session, WriteType writeType) { if (isForeignKeyRelationship()) { Object object = ((ObjectChangeSet)changeRecord.getOwner()).getUnitOfWorkClone(); this.writeFromObjectIntoRow(object, row, session, writeType); } else { super.writeFromObjectIntoRowWithChangeRecord(changeRecord, row, session, writeType); } }
/** * INTERNAL: * Get the appropriate attribute value from the object * and put it in the appropriate field of the database row. * Loop through the reference objects and extract the * primary keys and put them in the vector of "nested" rows. */ @Override public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session, WriteType writeType) { if (isForeignKeyRelationship()) { Object object = ((ObjectChangeSet)changeRecord.getOwner()).getUnitOfWorkClone(); this.writeFromObjectIntoRow(object, row, session, writeType); } else { super.writeFromObjectIntoRowWithChangeRecord(changeRecord, row, session, writeType); } }
/** * INTERNAL: * This row is built for update after shallow insert which happens in case of bidirectional inserts. * It contains the foreign keys with non null values that were set to null for shallow insert. * If mapping overrides writeFromObjectIntoRowForShallowInsert method it must override this one, too. */ public void writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord row, AbstractSession session, DatabaseTable table) { if (isReadOnly() || !isForeignKeyRelationship()) { return; } if (getForeignKeyGroupingElement() != null) { if (!getForeignKeyGroupingElement().getTable().equals(table)) { return; } } else if (this.getSourceForeignKeyFields().size() > 0) { if (!getSourceForeignKeyFields().get(0).getTable().equals(table)) { return; } } writeFromObjectIntoRow(object, row, session, WriteType.UPDATE); }
/** * INTERNAL: * This row is built for update after shallow insert which happens in case of bidirectional inserts. * It contains the foreign keys with non null values that were set to null for shallow insert. * If mapping overrides writeFromObjectIntoRowForShallowInsert method it must override this one, too. */ public void writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord row, AbstractSession session, DatabaseTable table) { if (isReadOnly() || !isForeignKeyRelationship()) { return; } if (getForeignKeyGroupingElement() != null) { if (!getForeignKeyGroupingElement().getTable().equals(table)) { return; } } else if (this.getSourceForeignKeyFields().size() > 0) { if (!getSourceForeignKeyFields().get(0).getTable().equals(table)) { return; } } writeFromObjectIntoRow(object, row, session, WriteType.UPDATE); }
/** * INTERNAL: * If any of the references objects has changed, write out * all the keys. */ @Override public void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery, AbstractRecord row) throws DescriptorException { if (!this.isAttributeValueInstantiatedOrChanged(writeQuery.getObject())) { return; } AbstractSession session = writeQuery.getSession(); if (session.isUnitOfWork()) { // PRS2074 fix for "traditional" Indirection Object collection1 = this.getRealCollectionAttributeValueFromObject(writeQuery.getObject(), session); Object collection2 = this.getRealCollectionAttributeValueFromObject(writeQuery.getBackupClone(), session); if (this.compareObjectsWithoutPrivateOwned(collection1, collection2, session)) { return;// nothing has changed - don't put anything in the row } } this.writeFromObjectIntoRow(writeQuery.getObject(), row, session, WriteType.UPDATE); }
/** * INTERNAL: * If any of the references objects has changed, write out * all the keys. */ public void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery, AbstractRecord row) throws DescriptorException { if (!this.isAttributeValueInstantiatedOrChanged(writeQuery.getObject())) { return; } AbstractSession session = writeQuery.getSession(); if (session.isUnitOfWork()) { // PRS2074 fix for "traditional" Indirection Object collection1 = this.getRealCollectionAttributeValueFromObject(writeQuery.getObject(), session); Object collection2 = this.getRealCollectionAttributeValueFromObject(writeQuery.getBackupClone(), session); if (this.compareObjectsWithoutPrivateOwned(collection1, collection2, session)) { return;// nothing has changed - don't put anything in the row } } this.writeFromObjectIntoRow(writeQuery.getObject(), row, session); }
/** * INTERNAL: * If any of the references objects has changed, write out * all the keys. */ @Override public void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery, AbstractRecord row) throws DescriptorException { if (!this.isAttributeValueInstantiatedOrChanged(writeQuery.getObject())) { return; } AbstractSession session = writeQuery.getSession(); if (session.isUnitOfWork()) { // PRS2074 fix for "traditional" Indirection Object collection1 = this.getRealCollectionAttributeValueFromObject(writeQuery.getObject(), session); Object collection2 = this.getRealCollectionAttributeValueFromObject(writeQuery.getBackupClone(), session); if (this.compareObjectsWithoutPrivateOwned(collection1, collection2, session)) { return;// nothing has changed - don't put anything in the row } } this.writeFromObjectIntoRow(writeQuery.getObject(), row, session, WriteType.UPDATE); }