/** * Return whether any process leading to object modification * should also affect its parts. * Used by write, insert, update, and delete. */ protected boolean shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query) { if (isForeignKeyRelationship()) { return super.shouldObjectModifyCascadeToParts(query); } else { if (this.isReadOnly()) { return false; } if (this.isPrivateOwned()) { return true; } return query.shouldCascadeAllParts(); } }
/** * Return whether any process leading to object modification * should also affect its parts. * Used by write, insert, update, and delete. */ @Override protected boolean shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query) { if (isForeignKeyRelationship()) { return super.shouldObjectModifyCascadeToParts(query); } else { if (this.isReadOnly()) { return false; } if (this.isPrivateOwned()) { return true; } return query.shouldCascadeAllParts(); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ @Override public void writeInsertFieldsIntoRow(AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeInsertFieldsIntoRow(row, session); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ public void writeInsertFieldsIntoRow(AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeInsertFieldsIntoRow(row, session); } }
/** * 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 row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsert(object, row, session); } }
/** * 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 writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsert(object, row, session); } }
/** * Return whether any process leading to object modification * should also affect its parts. * Used by write, insert, update, and delete. */ @Override protected boolean shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query) { if (isForeignKeyRelationship()) { return super.shouldObjectModifyCascadeToParts(query); } else { if (this.isReadOnly()) { return false; } if (this.isPrivateOwned()) { return true; } return query.shouldCascadeAllParts(); } }
/** * 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 writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsert(object, row, session); } }
/** * 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 row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsertWithChangeRecord(changeRecord, row, session); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ @Override public void writeInsertFieldsIntoRow(AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeInsertFieldsIntoRow(row, session); } }
/** * 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 row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsertWithChangeRecord(changeRecord, row, session); } }
/** * 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 row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsertWithChangeRecord(changeRecord, row, session); } }
/** * 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); }
if (this.isReadOnly()) { return;
if (this.isReadOnly()) { return;
if (this.isReadOnly()) { return;