/** * INTERNAL: */ protected void prepareOneToManySelectionQuery(OneToManyMapping sourceMapping, AbstractSession session) { // Clone the mapping because in reality that is what we have, that // is, a 1-M mapping to each class of the hierarchy. OneToManyMapping oneToMany = (OneToManyMapping) sourceMapping.clone(); // Update the foreign key fields on the mapping. Basically, take the // table name off and let the descriptor figure it out. Vector<DatabaseField> targetForeignKeyFields = new Vector<DatabaseField>(); for (DatabaseField fkField : oneToMany.getTargetForeignKeysToSourceKeys().keySet()) { targetForeignKeyFields.add(new DatabaseField(fkField.getName())); } // Update our foreign key fields and clear the key maps. oneToMany.setTargetForeignKeyFields(targetForeignKeyFields); oneToMany.getTargetForeignKeysToSourceKeys().clear(); oneToMany.getSourceKeysToTargetForeignKeys().clear(); addSelectionQuery(oneToMany, sourceMapping, session); }
DatabaseField sourcePrimaryKey = sourceKeys.next(); getTargetForeignKeysToSourceKeys().put(targetForeignKey, sourcePrimaryKey); getSourceKeysToTargetForeignKeys().put(sourcePrimaryKey, targetForeignKey);
/** * Prepare a cascade locking policy. */ public void prepareCascadeLockingPolicy() { CascadeLockingPolicy policy = new CascadeLockingPolicy(getDescriptor(), getReferenceDescriptor()); policy.setQueryKeyFields(getSourceKeysToTargetForeignKeys()); getReferenceDescriptor().addCascadeLockingPolicy(policy); }
DatabaseField sourcePrimaryKey = sourceKeys.next(); getTargetForeignKeysToSourceKeys().put(targetForeignKey, sourcePrimaryKey); getSourceKeysToTargetForeignKeys().put(sourcePrimaryKey, targetForeignKey);
DatabaseField sourcePrimaryKey = sourceKeys.next(); getTargetForeignKeysToSourceKeys().put(targetForeignKey, sourcePrimaryKey); getSourceKeysToTargetForeignKeys().put(sourcePrimaryKey, targetForeignKey);
/** * Prepare a cascade locking policy. */ @Override public void prepareCascadeLockingPolicy() { CascadeLockingPolicy policy = new CascadeLockingPolicy(getDescriptor(), getReferenceDescriptor()); policy.setQueryKeyFields(getSourceKeysToTargetForeignKeys()); getReferenceDescriptor().addCascadeLockingPolicy(policy); }
/** * Prepare a cascade locking policy. */ @Override public void prepareCascadeLockingPolicy() { CascadeLockingPolicy policy = new CascadeLockingPolicy(getDescriptor(), getReferenceDescriptor()); policy.setQueryKeyFields(getSourceKeysToTargetForeignKeys()); getReferenceDescriptor().addCascadeLockingPolicy(policy); }
OneToManyMapping otm = (OneToManyMapping) collectionMapping; populateInverseRelationship(otm, collection); Map<DatabaseField, DatabaseField> keyMap = otm.getSourceKeysToTargetForeignKeys(); List<DataObjectAttributeRelationship> attributeRelationships = new ArrayList<DataObjectAttributeRelationship>(); for (Map.Entry<DatabaseField, DatabaseField> keyRel : keyMap.entrySet()) {