prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getDescriptor(), session); AbstractRecord translationRow = new DatabaseRecord();
/** * INTERNAL: * Update target foreign key after a target object was added to the source. This follows following steps. * <p>- Extract primary key and its value from the source object. * <p>- Extract target key and its value from the target object. * <p>- Construct an update statement with above fields and values for target table. * <p>- execute the statement. */ public void updateTargetForeignKeyPostUpdateSource_ObjectAdded(ObjectLevelModifyQuery query, Object objectAdded, Map extraData) throws DatabaseException { if (isReadOnly()) { return; } ContainerPolicy cp = getContainerPolicy(); prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getSession()); AbstractRecord databaseRow = buildKeyRowForTargetUpdate(query); // Extract target field and its value. Construct insert statement and execute it int size = targetPrimaryKeyFields.size(); for (int index = 0; index < size; index++) { DatabaseField targetPrimaryKey = targetPrimaryKeyFields.get(index); Object targetKeyValue = getReferenceDescriptor().getObjectBuilder().extractValueFromObjectForField(cp.unwrapIteratorResult(objectAdded), targetPrimaryKey, query.getSession()); databaseRow.put(targetPrimaryKey, targetKeyValue); } ContainerPolicy.copyMapDataToRow(cp.getKeyMappingDataForWriteQuery(objectAdded, query.getSession()), databaseRow); if(listOrderField != null && extraData != null) { databaseRow.put(listOrderField, extraData.get(listOrderField)); } query.getSession().executeQuery(addTargetQuery, databaseRow); }
prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getDescriptor(), session); AbstractRecord translationRow = new DatabaseRecord();
/** * INTERNAL: * Update target foreign key after a target object was added to the source. This follows following steps. * <p>- Extract primary key and its value from the source object. * <p>- Extract target key and its value from the target object. * <p>- Construct an update statement with above fields and values for target table. * <p>- execute the statement. */ public void updateTargetForeignKeyPostUpdateSource_ObjectAdded(ObjectLevelModifyQuery query, Object objectAdded, Map extraData) throws DatabaseException { if (isReadOnly() || addTargetQuery == null) { return; } ContainerPolicy cp = getContainerPolicy(); prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getDescriptor(), query.getSession()); AbstractRecord databaseRow = buildKeyRowForTargetUpdate(query); // Extract target field and its value. Construct insert statement and execute it int size = targetPrimaryKeyFields.size(); for (int index = 0; index < size; index++) { DatabaseField targetPrimaryKey = targetPrimaryKeyFields.get(index); Object targetKeyValue = getReferenceDescriptor().getObjectBuilder().extractValueFromObjectForField(cp.unwrapIteratorResult(objectAdded), targetPrimaryKey, query.getSession()); databaseRow.put(targetPrimaryKey, targetKeyValue); } ContainerPolicy.copyMapDataToRow(cp.getKeyMappingDataForWriteQuery(objectAdded, query.getSession()), databaseRow); if(listOrderField != null && extraData != null) { databaseRow.put(listOrderField, extraData.get(listOrderField)); } query.getSession().executeQuery(addTargetQuery, databaseRow); }
prepareTranslationRow(query.getTranslationRow(), query.getObject(), session); AbstractRecord translationRow = new DatabaseRecord();
/** * INTERNAL: * Update target foreign key after a target object was added to the source. This follows following steps. * <p>- Extract primary key and its value from the source object. * <p>- Extract target key and its value from the target object. * <p>- Construct an update statement with above fields and values for target table. * <p>- execute the statement. */ public void updateTargetForeignKeyPostUpdateSource_ObjectAdded(ObjectLevelModifyQuery query, Object objectAdded, Map extraData) throws DatabaseException { if (isReadOnly() || addTargetQuery == null) { return; } ContainerPolicy cp = getContainerPolicy(); prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getDescriptor(), query.getSession()); AbstractRecord databaseRow = buildKeyRowForTargetUpdate(query); // Extract target field and its value. Construct insert statement and execute it int size = targetPrimaryKeyFields.size(); for (int index = 0; index < size; index++) { DatabaseField targetPrimaryKey = targetPrimaryKeyFields.get(index); Object targetKeyValue = getReferenceDescriptor().getObjectBuilder().extractValueFromObjectForField(cp.unwrapIteratorResult(objectAdded), targetPrimaryKey, query.getSession()); databaseRow.put(targetPrimaryKey, targetKeyValue); } ContainerPolicy.copyMapDataToRow(cp.getKeyMappingDataForWriteQuery(objectAdded, query.getSession()), databaseRow); if(listOrderField != null && extraData != null) { databaseRow.put(listOrderField, extraData.get(listOrderField)); } query.getSession().executeQuery(addTargetQuery, databaseRow); }
prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getDescriptor(), query.getSession());
prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getDescriptor(), query.getSession());
prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getSession());
} else { ContainerPolicy cp = getContainerPolicy(); prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getDescriptor(), query.getSession()); AbstractRecord keyRow = buildKeyRowForTargetUpdate(query);
prepareTranslationRow(query.getTranslationRow(), query.getObject(), query.getDescriptor(), query.getSession());