/** * INTERNAL: * Check to see if a custom query should be used for this query. * This is done before the query is copied and prepared/executed. * null means there is none. */ protected DatabaseQuery checkForCustomQuery(AbstractSession session, AbstractRecord translationRow) { checkDescriptor(session); // check if user defined a custom query DescriptorQueryManager queryManager = this.descriptor.getQueryManager(); if ((!isCallQuery())// this is not a hand-coded (custom SQL, SDK etc.) call && (!isUserDefined())// and this is not a user-defined query (in the query manager) && queryManager.hasUpdateQuery()) {// and there is a user-defined query (in the query manager) return queryManager.getUpdateQuery(); } return null; }
/** * INTERNAL: * Check to see if a custom query should be used for this query. * This is done before the query is copied and prepared/executed. * null means there is none. */ protected DatabaseQuery checkForCustomQuery(AbstractSession session, AbstractRecord translationRow) { checkDescriptor(session); // check if user defined a custom query DescriptorQueryManager queryManager = this.descriptor.getQueryManager(); if ((!isCallQuery())// this is not a hand-coded (custom SQL, SDK etc.) call && (!isUserDefined())// and this is not a user-defined query (in the query manager) && queryManager.hasUpdateQuery()) {// and there is a user-defined query (in the query manager) return queryManager.getUpdateQuery(); } return null; }
/** * INTERNAL: * Check to see if a custom query should be used for this query. * This is done before the query is copied and prepared/executed. * null means there is none. */ protected DatabaseQuery checkForCustomQuery(AbstractSession session, AbstractRecord translationRow) { checkDescriptor(session); // check if user defined a custom query DescriptorQueryManager queryManager = this.descriptor.getQueryManager(); if ((!isCallQuery())// this is not a hand-coded (custom SQL, SDK etc.) call && (!isUserDefined())// and this is not a user-defined query (in the query manager) && queryManager.hasUpdateQuery()) {// and there is a user-defined query (in the query manager) return queryManager.getUpdateQuery(); } return null; }
/** * INTERNAL: * Initialize the CMPPolicy settings. */ public void initialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException { // updateAllFields is true so set custom query in DescriptorQueryManager // to force full SQL. Don't overwrite a user defined query if (this.getUpdateAllFields() && !descriptor.getQueryManager().hasUpdateQuery()) { descriptor.getQueryManager().setUpdateQuery(new UpdateObjectQuery()); } // make sure updateAllFields is set if forceUpdate is true if (this.getForceUpdate() && !this.getUpdateAllFields()) { throw DescriptorException.updateAllFieldsNotSet(descriptor); } }
/** * INTERNAL: * Initialize the CMPPolicy settings. */ public void initialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException { // updateAllFields is true so set custom query in DescriptorQueryManager // to force full SQL. Don't overwrite a user defined query if (this.getUpdateAllFields() && !descriptor.getQueryManager().hasUpdateQuery()) { descriptor.getQueryManager().setUpdateQuery(new UpdateObjectQuery()); } // make sure updateAllFields is set if forceUpdate is true if (this.getForceUpdate() && !this.getUpdateAllFields()) { throw DescriptorException.updateAllFieldsNotSet(descriptor); } }
/** * INTERNAL: * Initialize the CMPPolicy settings. */ public void initialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException { // updateAllFields is true so set custom query in DescriptorQueryManager // to force full SQL. Don't overwrite a user defined query if (this.getUpdateAllFields() && !descriptor.getQueryManager().hasUpdateQuery()) { descriptor.getQueryManager().setUpdateQuery(new UpdateObjectQuery()); } // make sure updateAllFields is set if forceUpdate is true if (this.getForceUpdate() && !this.getUpdateAllFields()) { throw DescriptorException.updateAllFieldsNotSet(descriptor); } }
if (!queryManager.hasUpdateQuery()) { XQueryInteraction call = new XQueryInteraction(); call.setXQueryString(queryString);
if (queryManager.hasUpdateQuery()) {
if (queryManager.hasUpdateQuery()) {
setInsertQuery((InsertObjectQuery)parentQueryManager.getInsertQuery().clone()); if ((!hasUpdateQuery()) && (parentQueryManager.hasUpdateQuery())) { setUpdateQuery((UpdateObjectQuery)parentQueryManager.getUpdateQuery().clone());
setInsertQuery((InsertObjectQuery)parentQueryManager.getInsertQuery().clone()); if ((!hasUpdateQuery()) && (parentQueryManager.hasUpdateQuery())) { setUpdateQuery((UpdateObjectQuery)parentQueryManager.getUpdateQuery().clone());
setInsertQuery((InsertObjectQuery)parentQueryManager.getInsertQuery().clone()); if ((!hasUpdateQuery()) && (parentQueryManager.hasUpdateQuery())) { setUpdateQuery((UpdateObjectQuery)parentQueryManager.getUpdateQuery().clone());
&& queryManager.hasUpdateQuery()// there is a user-defined query
if (!queryManager.hasUpdateQuery()) { EISInteraction call = new MappedInteraction(); call.setProperty(MongoPlatform.OPERATION, MongoOperation.UPDATE);
&& queryManager.hasUpdateQuery()// there is a user-defined query
&& queryManager.hasUpdateQuery()// there is a user-defined query
method.addLine("descriptor.getQueryManager().setInsertCall(insertCall);"); if (descriptor.getQueryManager().hasUpdateQuery() && descriptor.getQueryManager().getUpdateQuery().isSQLCallQuery()) { method.addLine("descriptor.getQueryManager().setUpdateSQLString(\"" + constructValidSQLorEJBQLLinesForJavaSource(descriptor.getQueryManager().getUpdateQuery().getSQLString()) + "\");"); } else if (descriptor.getQueryManager().hasUpdateQuery() && descriptor.getQueryManager().getUpdateQuery().getDatasourceCall() instanceof XMLInteraction) { addXMLInteractionLines(method, (XMLInteraction)descriptor.getQueryManager().getUpdateQuery().getDatasourceCall(), "updateCall"); method.addLine("descriptor.getQueryManager().setUpdateCall(updateCall);");
method.addLine("descriptor.getQueryManager().setInsertCall(insertCall);"); if (descriptor.getQueryManager().hasUpdateQuery() && descriptor.getQueryManager().getUpdateQuery().isSQLCallQuery()) { method.addLine("descriptor.getQueryManager().setUpdateSQLString(\"" + constructValidSQLorEJBQLLinesForJavaSource(descriptor.getQueryManager().getUpdateQuery().getSQLString()) + "\");"); } else if (descriptor.getQueryManager().hasUpdateQuery() && descriptor.getQueryManager().getUpdateQuery().getDatasourceCall() instanceof XMLInteraction) { addXMLInteractionLines(method, (XMLInteraction)descriptor.getQueryManager().getUpdateQuery().getDatasourceCall(), "updateCall"); method.addLine("descriptor.getQueryManager().setUpdateCall(updateCall);");
method.addLine("descriptor.getQueryManager().setInsertCall(insertCall);"); if (descriptor.getQueryManager().hasUpdateQuery() && descriptor.getQueryManager().getUpdateQuery().isSQLCallQuery()) { method.addLine("descriptor.getQueryManager().setUpdateSQLString(\"" + constructValidSQLorEJBQLLinesForJavaSource(descriptor.getQueryManager().getUpdateQuery().getSQLString()) + "\");"); } else if (descriptor.getQueryManager().hasUpdateQuery() && descriptor.getQueryManager().getUpdateQuery().getDatasourceCall() instanceof XMLInteraction) { addXMLInteractionLines(method, (XMLInteraction)descriptor.getQueryManager().getUpdateQuery().getDatasourceCall(), "updateCall"); method.addLine("descriptor.getQueryManager().setUpdateCall(updateCall);");