/** * INTERNAL: * This row is built for shallow insert which happens in case of bidirectional inserts. * The foreign keys must be set to null to avoid constraints. */ public void writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord databaseRow, AbstractSession session) { if (isReadOnly() || (!isForeignKeyRelationship())) { return; } for (Enumeration fieldsEnum = getForeignKeyFields().elements(); fieldsEnum.hasMoreElements();) { DatabaseField sourceKey = (DatabaseField)fieldsEnum.nextElement(); databaseRow.add(sourceKey, null); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ public void writeInsertFieldsIntoRow(AbstractRecord databaseRow, AbstractSession session) { if (isReadOnly() || (!isForeignKeyRelationship())) { return; } for (Enumeration fieldsEnum = getForeignKeyFields().elements(); fieldsEnum.hasMoreElements();) { DatabaseField sourceKey = (DatabaseField)fieldsEnum.nextElement(); databaseRow.add(sourceKey, null); } }
/** * INTERNAL: * This row is built for shallow insert which happens in case of bidirectional inserts. * The foreign keys must be set to null to avoid constraints. */ public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord ChangeRecord, AbstractRecord databaseRow, AbstractSession session) { if (isReadOnly() || (!isForeignKeyRelationship())) { return; } for (Enumeration fieldsEnum = getForeignKeyFields().elements(); fieldsEnum.hasMoreElements();) { DatabaseField sourceKey = (DatabaseField)fieldsEnum.nextElement(); databaseRow.add(sourceKey, null); } }
/** * INTERNAL: * This row is built for shallow insert which happens in case of bidirectional inserts. * The foreign keys must be set to null to avoid constraints. */ @Override public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord ChangeRecord, AbstractRecord databaseRow, AbstractSession session) { if (isReadOnly() || (!isForeignKeyRelationship())) { return; } for (Enumeration fieldsEnum = getForeignKeyFields().elements(); fieldsEnum.hasMoreElements();) { DatabaseField sourceKey = (DatabaseField)fieldsEnum.nextElement(); databaseRow.add(sourceKey, null); } }
/** * INTERNAL: * This row is built for shallow insert which happens in case of bidirectional inserts. * The foreign keys must be set to null to avoid constraints. */ @Override public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord ChangeRecord, AbstractRecord databaseRow, AbstractSession session) { if (isReadOnly() || (!isForeignKeyRelationship())) { return; } for (Enumeration fieldsEnum = getForeignKeyFields().elements(); fieldsEnum.hasMoreElements();) { DatabaseField sourceKey = (DatabaseField)fieldsEnum.nextElement(); databaseRow.add(sourceKey, null); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ @Override public void writeInsertFieldsIntoRow(AbstractRecord databaseRow, AbstractSession session) { if (isReadOnly() || (!isForeignKeyRelationship())) { return; } for (Enumeration fieldsEnum = getForeignKeyFields().elements(); fieldsEnum.hasMoreElements();) { DatabaseField sourceKey = (DatabaseField)fieldsEnum.nextElement(); if (shouldWriteField(sourceKey, WriteType.INSERT)) { databaseRow.add(sourceKey, null); } } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ @Override public void writeInsertFieldsIntoRow(AbstractRecord databaseRow, AbstractSession session) { if (isReadOnly() || (!isForeignKeyRelationship())) { return; } for (Enumeration fieldsEnum = getForeignKeyFields().elements(); fieldsEnum.hasMoreElements();) { DatabaseField sourceKey = (DatabaseField)fieldsEnum.nextElement(); if (shouldWriteField(sourceKey, WriteType.INSERT)) { databaseRow.add(sourceKey, null); } } }
/** * INTERNAL: * Delete privately owned parts */ public void preDelete(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException { if(this.mechanism != null && !isReadOnly()) { AbstractRecord sourceRow = this.mechanism.buildRelationTableSourceRow(query.getObject(), query.getSession(), this); query.getSession().executeQuery(mechanism.deleteQuery, sourceRow); } super.preDelete(query); }
relationship.setReadOnly(relationshipMapping.isReadOnly()); relationship.setSavedWithParent(relationshipMapping.isCascadePersist()); relationship.setDeletedWithParent(relationshipMapping.isCascadeRemove());
public void postInsert(WriteObjectQuery query) throws DatabaseException { super.postInsert(query); if(this.mechanism != null && !isReadOnly()) { Object targetObject = getRealAttributeValueFromObject(query.getObject(), query.getSession()); if (targetObject == null) {
public void postInsert(WriteObjectQuery query) throws DatabaseException { super.postInsert(query); if(this.mechanism != null && !isReadOnly()) { Object targetObject = getRealAttributeValueFromObject(query.getObject(), query.getSession()); if (targetObject == null) {
if(this.mechanism != null && !isReadOnly()) { Object targetObject = getRealAttributeValueFromObject(query.getObject(), query.getSession()); if (targetObject == null) {
if(!isReadOnly()) { sourceRow = this.mechanism.buildRelationTableSourceRow(query.getObject(), query.getSession(), this); query.getSession().executeQuery(this.mechanism.deleteQuery, sourceRow);
if(!isReadOnly()) { sourceRow = this.mechanism.buildRelationTableSourceRow(query.getObject(), query.getSession(), this); query.getSession().executeQuery(this.mechanism.deleteQuery, sourceRow);
if(!isReadOnly()) { sourceRow = this.mechanism.buildRelationTableSourceRow(query.getObject(), query.getSession(), this); query.getSession().executeQuery(this.mechanism.deleteQuery, sourceRow);