/** * Do any required validation for this node. Throw an exception if it's incorrect. * Ensure that both sides are not data expressions. */ public void validateNode() { if (this.firstChild != null) { if (this.firstChild.isDataExpression() || this.firstChild.isConstantExpression()) { throw QueryException.invalidExpression(this); } } if (this.secondChild != null) { if (this.secondChild.isDataExpression() || this.secondChild.isConstantExpression()) { throw QueryException.invalidExpression(this); } } }
/** * Do any required validation for this node. Throw an exception if it's incorrect. * Ensure that both sides are not data expressions. */ public void validateNode() { if (this.firstChild != null) { if (this.firstChild.isDataExpression() || this.firstChild.isConstantExpression()) { throw QueryException.invalidExpression(this); } } if (this.secondChild != null) { if (this.secondChild.isDataExpression() || this.secondChild.isConstantExpression()) { throw QueryException.invalidExpression(this); } } }
/** * Do any required validation for this node. Throw an exception if it's incorrect. * Ensure that both sides are not data expressions. */ public void validateNode() { if (this.firstChild != null) { if (this.firstChild.isDataExpression() || this.firstChild.isConstantExpression()) { throw QueryException.invalidExpression(this); } } if (this.secondChild != null) { if (this.secondChild.isDataExpression() || this.secondChild.isConstantExpression()) { throw QueryException.invalidExpression(this); } } }
/** * INTERNAL: * Print SQL using the operator. */ public void printSQL(ExpressionSQLPrinter printer) { // If all children are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && !this.children.isEmpty()) { boolean allParams = true; for (Iterator iterator = this.children.iterator(); iterator.hasNext(); ) { Expression child = (Expression)iterator.next(); if (!(child.isParameterExpression() || child.isConstantExpression())) { allParams = false; } } if (allParams) { printer.getCall().setUsesBinding(false); } } ExpressionOperator realOperator; realOperator = getPlatformOperator(printer.getPlatform()); realOperator.printCollection(this.children, printer); }
/** * INTERNAL: * Print SQL using the operator. */ @Override public void printSQL(ExpressionSQLPrinter printer) { // If all children are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && !this.children.isEmpty()) { boolean allParams = true; for (Iterator<Expression> iterator = this.children.iterator(); iterator.hasNext(); ) { Expression child = iterator.next(); if (!(child.isParameterExpression() || child.isConstantExpression())) { allParams = false; } } if (allParams) { printer.getCall().setUsesBinding(false); } } ExpressionOperator realOperator; realOperator = getPlatformOperator(printer.getPlatform()); realOperator.printCollection(this.children, printer); }
/** * INTERNAL: * Print SQL using the operator. */ public void printSQL(ExpressionSQLPrinter printer) { // If all children are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && !this.children.isEmpty()) { boolean allParams = true; for (Iterator iterator = this.children.iterator(); iterator.hasNext(); ) { Expression child = (Expression)iterator.next(); if (!(child.isParameterExpression() || child.isConstantExpression())) { allParams = false; } } if (allParams) { printer.getCall().setUsesBinding(false); } } ExpressionOperator realOperator; realOperator = getPlatformOperator(printer.getPlatform()); realOperator.printCollection(this.children, printer); }
/** * INTERNAL: * Print SQL */ public void printSQL(ExpressionSQLPrinter printer) { // If both sides are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && ((this.firstChild.isParameterExpression() || this.firstChild.isConstantExpression()) && (this.secondChild.isParameterExpression() || this.secondChild.isConstantExpression()))) { printer.getCall().setUsesBinding(false); } if (isEqualNull(printer)) { this.firstChild.isNull().printSQL(printer); } else if (isNotEqualNull(printer)) { this.firstChild.notNull().printSQL(printer); } else { super.printSQL(printer); } }
/** * INTERNAL: * Print SQL */ public void printSQL(ExpressionSQLPrinter printer) { // If both sides are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && ((this.firstChild.isParameterExpression() || this.firstChild.isConstantExpression()) && (this.secondChild.isParameterExpression() || this.secondChild.isConstantExpression()))) { printer.getCall().setUsesBinding(false); } if (isEqualNull(printer)) { this.firstChild.isNull().printSQL(printer); } else if (isNotEqualNull(printer)) { this.firstChild.notNull().printSQL(printer); } else { super.printSQL(printer); } }
/** * INTERNAL: * Print SQL */ public void printSQL(ExpressionSQLPrinter printer) { // If both sides are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && ((this.firstChild.isParameterExpression() || this.firstChild.isConstantExpression()) && (this.secondChild.isParameterExpression() || this.secondChild.isConstantExpression()))) { printer.getCall().setUsesBinding(false); } if (isEqualNull(printer)) { this.firstChild.isNull().printSQL(printer); } else if (isNotEqualNull(printer)) { this.firstChild.notNull().printSQL(printer); } else { super.printSQL(printer); } }
} else if (item.getDescriptor() != null) { returnQuery.getReturnTypes().add(item.getDescriptor().getJavaClass().getSimpleName()); } else if (item.getAttributeExpression() != null && item.getAttributeExpression().isConstantExpression()) { returnQuery.getReturnTypes().add(((ConstantExpression) item.getAttributeExpression()).getValue().getClass().getSimpleName()); } else {
} else if (item.getDescriptor() != null) { returnQuery.getReturnTypes().add(item.getDescriptor().getJavaClass().getSimpleName()); } else if (item.getAttributeExpression() != null && item.getAttributeExpression().isConstantExpression()) { returnQuery.getReturnTypes().add(((ConstantExpression) item.getAttributeExpression()).getValue().getClass().getSimpleName()); } else {
/** * Check if the expression is an equal null expression, these must be handle in a special way in SQL. */ public boolean isEqualNull(ExpressionSQLPrinter printer) { if (isObjectComparison()) { return false; } else if (this.operator.getSelector() != ExpressionOperator.Equal) { return false; } else if (this.secondChild.isConstantExpression() && (((ConstantExpression)this.secondChild).getValue() == null)) { return true; } else if (this.secondChild.isParameterExpression() && (printer.getTranslationRow() != null) && (((ParameterExpression)this.secondChild).getValue(printer.getTranslationRow(), printer.getSession()) == null)) { return true; } else { return false; } }
/** * Check if the expression is an equal null expression, these must be handle in a special way in SQL. */ public boolean isNotEqualNull(ExpressionSQLPrinter printer) { if (isObjectComparison()) { return false; } else if (this.operator.getSelector() != ExpressionOperator.NotEqual) { return false; } else if (this.secondChild.isConstantExpression() && (((ConstantExpression)this.secondChild).getValue() == null)) { return true; } else if (this.secondChild.isParameterExpression() && (printer.getTranslationRow() != null) && (((ParameterExpression)this.secondChild).getValue(printer.getTranslationRow(), printer.getSession()) == null)) { return true; } else { return false; } }
/** * Check if the expression is an equal null expression, these must be handle in a special way in SQL. */ public boolean isNotEqualNull(ExpressionSQLPrinter printer) { if (isObjectComparison(printer.getSession())) { return false; } else if (this.operator.getSelector() != ExpressionOperator.NotEqual) { return false; } else if (this.secondChild.isConstantExpression() && (((ConstantExpression)this.secondChild).getValue() == null)) { return true; } else if (this.secondChild.isParameterExpression() && (printer.getTranslationRow() != null) && (((ParameterExpression)this.secondChild).getValue(printer.getTranslationRow(), printer.getSession()) == null)) { return true; } else { return false; } }
/** * Check if the expression is an equal null expression, these must be handle in a special way in SQL. */ public boolean isEqualNull(ExpressionSQLPrinter printer) { if (isObjectComparison(printer.getSession())) { return false; } else if (this.operator.getSelector() != ExpressionOperator.Equal) { return false; } else if (this.secondChild.isConstantExpression() && (((ConstantExpression)this.secondChild).getValue() == null)) { return true; } else if (this.secondChild.isParameterExpression() && (printer.getTranslationRow() != null) && (((ParameterExpression)this.secondChild).getValue(printer.getTranslationRow(), printer.getSession()) == null)) { return true; } else { return false; } }
/** * Check if the expression is an equal null expression, these must be handle in a special way in SQL. */ public boolean isNotEqualNull(ExpressionSQLPrinter printer) { if (isObjectComparison(printer.getSession())) { return false; } else if (this.operator.getSelector() != ExpressionOperator.NotEqual) { return false; } else if (this.secondChild.isConstantExpression() && (((ConstantExpression)this.secondChild).getValue() == null)) { return true; } else if (this.secondChild.isParameterExpression() && (printer.getTranslationRow() != null) && (((ParameterExpression)this.secondChild).getValue(printer.getTranslationRow(), printer.getSession()) == null)) { return true; } else { return false; } }
/** * Check if the expression is an equal null expression, these must be handle in a special way in SQL. */ public boolean isEqualNull(ExpressionSQLPrinter printer) { if (isObjectComparison(printer.getSession())) { return false; } else if (this.operator.getSelector() != ExpressionOperator.Equal) { return false; } else if (this.secondChild.isConstantExpression() && (((ConstantExpression)this.secondChild).getValue() == null)) { return true; } else if (this.secondChild.isParameterExpression() && (printer.getTranslationRow() != null) && (((ParameterExpression)this.secondChild).getValue(printer.getTranslationRow(), printer.getSession()) == null)) { return true; } else { return false; } }
&& (!((OneToOneMapping)mapping).hasCustomSelectionQuery()) && ((OneToOneMapping)mapping).isForeignKeyRelationship() && (second.isConstantExpression() || second.isParameterExpression())) { DatabaseField targetField = ((QueryKeyExpression)first).getField(); DatabaseField sourceField = ((OneToOneMapping)mapping).getTargetToSourceKeyFields().get(targetField);
&& (!((OneToOneMapping)mapping).hasCustomSelectionQuery()) && ((OneToOneMapping)mapping).isForeignKeyRelationship() && (second.isConstantExpression() || second.isParameterExpression())) { DatabaseField targetField = ((QueryKeyExpression)first).getField(); DatabaseField sourceField = ((OneToOneMapping)mapping).getTargetToSourceKeyFields().get(targetField);
} else if (item.getDescriptor() != null) { property = buildProperty(context, item.getDescriptor().getJavaClass()); } else if (item.getAttributeExpression() != null && item.getAttributeExpression().isConstantExpression()) { property = buildProperty(context, ((ConstantExpression) item.getAttributeExpression()).getValue().getClass()); } else {