/** * Build the row of all of the fields used for insertion. */ public AbstractRecord buildTemplateInsertRow(AbstractSession session) { AbstractRecord databaseRow = createRecord(session); buildTemplateInsertRow(session, databaseRow); return databaseRow; }
/** * Build the row of all of the fields used for insertion. */ public AbstractRecord buildTemplateInsertRow(AbstractSession session) { AbstractRecord databaseRow = createRecord(session); buildTemplateInsertRow(session, databaseRow); return databaseRow; }
/** * Build the row of all of the fields used for insertion. */ public AbstractRecord buildTemplateInsertRow(AbstractSession session) { AbstractRecord databaseRow = createRecord(session); buildTemplateInsertRow(session, databaseRow); return databaseRow; }
/** * INTERNAL: * Build and return a "template" database row with all the fields * set to null. */ protected AbstractRecord buildTemplateInsertRow(AbstractSession session) { AbstractRecord result = getReferenceDescriptor().getObjectBuilder().buildTemplateInsertRow(session); List processedMappings = (List)getReferenceDescriptor().getMappings().clone(); if (getReferenceDescriptor().hasInheritance()) { Enumeration children = getReferenceDescriptor().getInheritancePolicy().getChildDescriptors().elements(); while (children.hasMoreElements()) { Enumeration mappings = ((ClassDescriptor)children.nextElement()).getMappings().elements(); while (mappings.hasMoreElements()) { DatabaseMapping mapping = (DatabaseMapping)mappings.nextElement(); // Only write mappings once. if (!processedMappings.contains(mapping)) { mapping.writeInsertFieldsIntoRow(result, session); processedMappings.add(mapping); } } } } return result; }
/** * INTERNAL: * Build and return a "template" database row with all the fields * set to null. */ protected AbstractRecord buildTemplateInsertRow(AbstractSession session) { AbstractRecord result = getReferenceDescriptor().getObjectBuilder().buildTemplateInsertRow(session); List processedMappings = (List)getReferenceDescriptor().getMappings().clone(); if (getReferenceDescriptor().hasInheritance()) { for (ClassDescriptor child : getReferenceDescriptor().getInheritancePolicy().getChildDescriptors()) { for (DatabaseMapping mapping : child.getMappings()) { // Only write mappings once. if (!processedMappings.contains(mapping)) { mapping.writeInsertFieldsIntoRow(result, session); processedMappings.add(mapping); } } } } return result; }
/** * INTERNAL: * Build and return a "template" database row with all the fields * set to null. */ protected AbstractRecord buildTemplateInsertRow(AbstractSession session) { AbstractRecord result = getReferenceDescriptor().getObjectBuilder().buildTemplateInsertRow(session); List processedMappings = (List)getReferenceDescriptor().getMappings().clone(); if (getReferenceDescriptor().hasInheritance()) { for (ClassDescriptor child : getReferenceDescriptor().getInheritancePolicy().getChildDescriptors()) { for (DatabaseMapping mapping : child.getMappings()) { // Only write mappings once. if (!processedMappings.contains(mapping)) { mapping.writeInsertFieldsIntoRow(result, session); processedMappings.add(mapping); } } } } return result; }
/** * INTERNAL: Generates the insert stored procedure for this descriptor */ protected StoredProcedureDefinition generateInsertStoredProcedure(ClassDescriptor descriptor) { InsertObjectQuery insertQuery = new InsertObjectQuery(); insertQuery.setDescriptor(descriptor); insertQuery.setModifyRow(descriptor.getObjectBuilder().buildTemplateInsertRow(getSession())); return this.generateObjectStoredProcedure(insertQuery, descriptor.getFields(), "INS_"); }
/** * INTERNAL: Generates the insert stored procedure for this descriptor */ protected StoredProcedureDefinition generateInsertStoredProcedure(ClassDescriptor descriptor) { InsertObjectQuery insertQuery = new InsertObjectQuery(); insertQuery.setDescriptor(descriptor); insertQuery.setModifyRow(descriptor.getObjectBuilder().buildTemplateInsertRow(getSession())); return this.generateObjectStoredProcedure(insertQuery, descriptor.getFields(), "INS_"); }
/** * INTERNAL: Generates the insert stored procedure for this descriptor */ protected StoredProcedureDefinition generateInsertStoredProcedure(ClassDescriptor descriptor) { InsertObjectQuery insertQuery = new InsertObjectQuery(); insertQuery.setDescriptor(descriptor); insertQuery.setModifyRow(descriptor.getObjectBuilder().buildTemplateInsertRow(getSession())); return this.generateObjectStoredProcedure(insertQuery, descriptor.getFields(), "INS_"); }
/** * INTERNAL: * Returns clone of InsertObjectQuery from the reference descriptor, if it is not set - create it. */ protected InsertObjectQuery getInsertObjectQuery(AbstractSession session, ClassDescriptor desc) { InsertObjectQuery insertQuery = desc.getQueryManager().getInsertQuery(); if (insertQuery == null) { insertQuery = new InsertObjectQuery(); desc.getQueryManager().setInsertQuery(insertQuery); } if (insertQuery.getModifyRow() == null) { AbstractRecord modifyRow = new DatabaseRecord(); for (int i = 0; i < getTargetForeignKeyFields().size(); i++) { DatabaseField field = getTargetForeignKeyFields().elementAt(i); modifyRow.put(field, null); } desc.getObjectBuilder().buildTemplateInsertRow(session, modifyRow); getContainerPolicy().addFieldsForMapKey(modifyRow); if(this.listOrderField != null) { modifyRow.put(this.listOrderField, null); } insertQuery.setModifyRow(modifyRow); } return insertQuery; }
/** * INTERNAL: * Returns clone of InsertObjectQuery from the reference descriptor, if it is not set - create it. */ protected InsertObjectQuery getInsertObjectQuery(AbstractSession session, ClassDescriptor desc) { InsertObjectQuery insertQuery = desc.getQueryManager().getInsertQuery(); if (insertQuery == null) { insertQuery = new InsertObjectQuery(); desc.getQueryManager().setInsertQuery(insertQuery); } if (insertQuery.getModifyRow() == null) { AbstractRecord modifyRow = new DatabaseRecord(); for (int i = 0; i < getTargetForeignKeyFields().size(); i++) { DatabaseField field = getTargetForeignKeyFields().elementAt(i); modifyRow.put(field, null); } desc.getObjectBuilder().buildTemplateInsertRow(session, modifyRow); getContainerPolicy().addFieldsForMapKey(modifyRow); if(this.listOrderField != null) { modifyRow.put(this.listOrderField, null); } insertQuery.setModifyRow(modifyRow); } return insertQuery; }
queryManager.getInsertQuery().setModifyRow(getObjectBuilder().buildTemplateInsertRow(session));
queryManager.getInsertQuery().setModifyRow(getObjectBuilder().buildTemplateInsertRow(session));
getInsertQuery().setModifyRow(getDescriptor().getObjectBuilder().buildTemplateInsertRow(session));