/** * Return the index into our relation id array of the value for the * given column. */ private int getRelationIdIndex(Column col) { Column[] cols = getTable().getRelationIdColumns(); for (int i = 0; i < cols.length; i++) if (cols[i] == col) return i; return -1; }
/** * Return the index into our relation id array of the value for the * given column. */ private int getRelationIdIndex(Column col) { Column[] cols = getTable().getRelationIdColumns(); for (int i = 0; i < cols.length; i++) if (cols[i] == col) return i; return -1; }
/** * Return the index into our relation id array of the value for the * given column. */ private int getRelationIdIndex(Column col) { Column[] cols = getTable().getRelationIdColumns(); for (int i = 0; i < cols.length; i++) if (cols[i] == col) return i; return -1; }
/** * Return the index into our relation id array of the value for the * given column. */ private int getRelationIdIndex(Column col) { Column[] cols = getTable().getRelationIdColumns(); for (int i = 0; i < cols.length; i++) if (cols[i] == col) return i; return -1; }
/** * Return the index into our relation id array of the value for the * given column. */ private int getRelationIdIndex(Column col) { Column[] cols = getTable().getRelationIdColumns(); for (int i = 0; i < cols.length; i++) if (cols[i] == col) return i; return -1; }
public String toString() { StringBuilder buf = new StringBuilder(); buf.append("PrimaryRow["); switch (getAction()) { case ACTION_UPDATE: buf.append("UPDATE"); break; case ACTION_INSERT: buf.append("INSERT"); break; case ACTION_DELETE: buf.append("DELETE"); break; default: buf.append("UNKNOWN"); } buf.append(" ").append(getTable().getName()).append("]: "); buf.append(_pk); return buf.toString(); } }
public String toString() { StringBuilder buf = new StringBuilder(); buf.append("PrimaryRow["); switch (getAction()) { case ACTION_UPDATE: buf.append("UPDATE"); break; case ACTION_INSERT: buf.append("INSERT"); break; case ACTION_DELETE: buf.append("DELETE"); break; default: buf.append("UNKNOWN"); } buf.append(" ").append(getTable().getName()).append("]: "); buf.append(_pk); return buf.toString(); } }
public String toString() { StringBuilder buf = new StringBuilder(); buf.append("PrimaryRow["); switch (getAction()) { case ACTION_UPDATE: buf.append("UPDATE"); break; case ACTION_INSERT: buf.append("INSERT"); break; case ACTION_DELETE: buf.append("DELETE"); break; default: buf.append("UNKNOWN"); } buf.append(" ").append(getTable().getName()).append("]: "); buf.append(_pk); return buf.toString(); } }
public String toString() { StringBuilder buf = new StringBuilder(); buf.append("PrimaryRow["); switch (getAction()) { case ACTION_UPDATE: buf.append("UPDATE"); break; case ACTION_INSERT: buf.append("INSERT"); break; case ACTION_DELETE: buf.append("DELETE"); break; default: buf.append("UNKNOWN"); } buf.append(" ").append(getTable().getName()).append("]: "); buf.append(_pk); return buf.toString(); } }
super.wherePrimaryKey(_pk); if (_fkSet != null) { ForeignKey[] fks = getTable().getForeignKeys(); ColumnIO io; for (int i = 0; i < _fkSet.length; i++) { Column[] cols = getTable().getRelationIdColumns(); for (int i = 0; i < _relSet.length; i++) if (_relSet[i] != null) ForeignKey[] fks = getTable().getForeignKeys(); for (int i = 0; i < _fkWhere.length; i++) if (_fkWhere[i] != null)
public void setRelationId(Column col, OpenJPAStateManager sm, RelationId rel) throws SQLException { if (sm == null || sm.getObjectId() != null || !sm.isNew() || sm.isFlushed() || !isPrimaryKeyAutoAssigned(sm)) super.setRelationId(col, sm, rel); else { if (_relSet == null) { Column[] cols = getTable().getRelationIdColumns(); _relSet = new OpenJPAStateManager[cols.length]; _callbacks = new RelationId[cols.length]; } int idx = getRelationIdIndex(col); _relSet[idx] = sm; _callbacks[idx] = rel; } }
public void setRelationId(Column col, OpenJPAStateManager sm, RelationId rel) throws SQLException { if (sm == null || sm.getObjectId() != null || !sm.isNew() || sm.isFlushed() || !isPrimaryKeyAutoAssigned(sm)) super.setRelationId(col, sm, rel); else { if (_relSet == null) { Column[] cols = getTable().getRelationIdColumns(); _relSet = new OpenJPAStateManager[cols.length]; _callbacks = new RelationId[cols.length]; } int idx = getRelationIdIndex(col); _relSet[idx] = sm; _callbacks[idx] = rel; } }
/** * Break a circular dependency caused by delete operations. * If deleted row A has a ciricular fk to deleted row B, then use an update * statement to null A's fk to B before deleting B, then delete A. * @param edge Edge in the dependency graph corresponding to a foreign key * constraint. This dependency is broken by nullifying the foreign key. * @param deleteUpdates Collection of update statements that are executed * before the delete operations are flushed */ private void addDeleteUpdate(Edge edge, Collection deleteUpdates) throws SQLException { PrimaryRow row; RowImpl update; ForeignKey fk; // copy where conditions into new update that nulls the fk row = (PrimaryRow) edge.getTo(); update = new PrimaryRow(row.getTable(), Row.ACTION_UPDATE, null); row.copyInto(update, true); if (edge.getUserObject() instanceof ForeignKey) { fk = (ForeignKey) edge.getUserObject(); update.setForeignKey(fk, row.getForeignKeyIO(fk), null); } else update.setNull((Column) edge.getUserObject()); deleteUpdates.add(update); }
public void setRelationId(Column col, OpenJPAStateManager sm, RelationId rel) throws SQLException { if (sm == null || sm.getObjectId() != null || !sm.isNew() || sm.isFlushed() || !isPrimaryKeyAutoAssigned(sm)) super.setRelationId(col, sm, rel); else { if (_relSet == null) { Column[] cols = getTable().getRelationIdColumns(); _relSet = new OpenJPAStateManager[cols.length]; _callbacks = new RelationId[cols.length]; } int idx = getRelationIdIndex(col); _relSet[idx] = sm; _callbacks[idx] = rel; } }
public void setRelationId(Column col, OpenJPAStateManager sm, RelationId rel) throws SQLException { if (sm == null || sm.getObjectId() != null || !sm.isNew() || sm.isFlushed() || !isPrimaryKeyAutoAssigned(sm)) super.setRelationId(col, sm, rel); else { if (_relSet == null) { Column[] cols = getTable().getRelationIdColumns(); _relSet = new OpenJPAStateManager[cols.length]; _callbacks = new RelationId[cols.length]; } int idx = getRelationIdIndex(col); _relSet[idx] = sm; _callbacks[idx] = rel; } }
public void setRelationId(Column col, OpenJPAStateManager sm, RelationId rel) throws SQLException { if (sm == null || sm.getObjectId() != null || !sm.isNew() || sm.isFlushed() || !isPrimaryKeyAutoAssigned(sm)) super.setRelationId(col, sm, rel); else { if (_relSet == null) { Column[] cols = getTable().getRelationIdColumns(); _relSet = new OpenJPAStateManager[cols.length]; _callbacks = new RelationId[cols.length]; } int idx = getRelationIdIndex(col); _relSet[idx] = sm; _callbacks[idx] = rel; } }
/** * Break a circular dependency caused by delete operations. * If deleted row A has a ciricular fk to deleted row B, then use an update * statement to null A's fk to B before deleting B, then delete A. * @param edge Edge in the dependency graph corresponding to a foreign key * constraint. This dependency is broken by nullifying the foreign key. * @param deleteUpdates Collection of update statements that are executed * before the delete operations are flushed */ private void addDeleteUpdate(Edge edge, Collection deleteUpdates) throws SQLException { PrimaryRow row; RowImpl update; ForeignKey fk; // copy where conditions into new update that nulls the fk row = (PrimaryRow) edge.getTo(); update = new PrimaryRow(row.getTable(), Row.ACTION_UPDATE, null); row.copyInto(update, true); if (edge.getUserObject() instanceof ForeignKey) { fk = (ForeignKey) edge.getUserObject(); update.setForeignKey(fk, row.getForeignKeyIO(fk), null); } else update.setNull((Column) edge.getUserObject()); deleteUpdates.add(update); }
/** * Break a circular dependency caused by delete operations. * If deleted row A has a ciricular fk to deleted row B, then use an update * statement to null A's fk to B before deleting B, then delete A. * @param edge Edge in the dependency graph corresponding to a foreign key * constraint. This dependency is broken by nullifying the foreign key. * @param deleteUpdates Collection of update statements that are executed * before the delete operations are flushed */ private void addDeleteUpdate(Edge edge, Collection deleteUpdates) throws SQLException { PrimaryRow row; RowImpl update; ForeignKey fk; // copy where conditions into new update that nulls the fk row = (PrimaryRow) edge.getTo(); update = new PrimaryRow(row.getTable(), Row.ACTION_UPDATE, null); row.copyInto(update, true); if (edge.getUserObject() instanceof ForeignKey) { fk = (ForeignKey) edge.getUserObject(); update.setForeignKey(fk, row.getForeignKeyIO(fk), null); } else update.setNull((Column) edge.getUserObject()); deleteUpdates.add(update); }
/** * Break a circular dependency caused by delete operations. * If deleted row A has a ciricular fk to deleted row B, then use an update * statement to null A's fk to B before deleting B, then delete A. * @param edge Edge in the dependency graph corresponding to a foreign key * constraint. This dependency is broken by nullifying the foreign key. * @param deleteUpdates Collection of update statements that are executed * before the delete operations are flushed */ private void addDeleteUpdate(Edge edge, Collection deleteUpdates) throws SQLException { PrimaryRow row; RowImpl update; ForeignKey fk; // copy where conditions into new update that nulls the fk row = (PrimaryRow) edge.getTo(); update = new PrimaryRow(row.getTable(), Row.ACTION_UPDATE, null); row.copyInto(update, true); if (edge.getUserObject() instanceof ForeignKey) { fk = (ForeignKey) edge.getUserObject(); update.setForeignKey(fk, row.getForeignKeyIO(fk), null); } else update.setNull((Column) edge.getUserObject()); deleteUpdates.add(update); }
/** * Break a circular dependency caused by delete operations. * If deleted row A has a ciricular fk to deleted row B, then use an update * statement to null A's fk to B before deleting B, then delete A. * @param edge Edge in the dependency graph corresponding to a foreign key * constraint. This dependency is broken by nullifying the foreign key. * @param deleteUpdates Collection of update statements that are executed * before the delete operations are flushed */ private void addDeleteUpdate(Edge edge, Collection deleteUpdates) throws SQLException { PrimaryRow row; RowImpl update; ForeignKey fk; // copy where conditions into new update that nulls the fk row = (PrimaryRow) edge.getTo(); update = new PrimaryRow(row.getTable(), Row.ACTION_UPDATE, null); row.copyInto(update, true); if (edge.getUserObject() instanceof ForeignKey) { fk = (ForeignKey) edge.getUserObject(); update.setForeignKey(fk, row.getForeignKeyIO(fk), null); } else update.setNull((Column) edge.getUserObject()); deleteUpdates.add(update); }