Author: steve.ebersole(a)jboss.com
Date: 2008-11-10 13:14:53 -0500 (Mon, 10 Nov 2008)
New Revision: 15540
Modified:
core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree/BinaryLogicOperatorNode.java
Log:
HHH-530 : problem with parameter-pulling when row value constructor morphed on dialects
not supporting
Modified:
core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree/BinaryLogicOperatorNode.java
===================================================================
---
core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree/BinaryLogicOperatorNode.java 2008-11-10
18:14:34 UTC (rev 15539)
+++
core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree/BinaryLogicOperatorNode.java 2008-11-10
18:14:53 UTC (rev 15540)
@@ -4,9 +4,9 @@
import org.hibernate.Hibernate;
import org.hibernate.TypeMismatchException;
import org.hibernate.HibernateException;
+import org.hibernate.param.ParameterSpecification;
import org.hibernate.util.StringHelper;
import org.hibernate.hql.antlr.HqlSqlTokenTypes;
-import org.hibernate.dialect.HSQLDialect;
import org.hibernate.engine.SessionFactoryImplementor;
import antlr.SemanticException;
import antlr.collections.AST;
@@ -94,9 +94,18 @@
String[] lhsElementTexts = extractMutationTexts( getLeftHandOperand(), valueElements
);
String[] rhsElementTexts = extractMutationTexts( getRightHandOperand(), valueElements
);
+ ParameterSpecification lhsEmbeddedCompositeParameterSpecification =
+ getLeftHandOperand() == null || ( !ParameterNode.class.isInstance(
getLeftHandOperand() ) )
+ ? null
+ : ( ( ParameterNode ) getLeftHandOperand() ).getHqlParameterSpecification();
+
+ ParameterSpecification rhsEmbeddedCompositeParameterSpecification =
+ getRightHandOperand() == null || ( !ParameterNode.class.isInstance(
getRightHandOperand() ) )
+ ? null
+ : ( ( ParameterNode ) getRightHandOperand() ).getHqlParameterSpecification();
+
AST container = this;
for ( int i = valueElements - 1; i > 0; i-- ) {
-
if ( i == 1 ) {
AST op1 = getASTFactory().create( comparisonType, comparisonText );
AST lhs1 = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, lhsElementTexts[0] );
@@ -110,6 +119,16 @@
op2.setFirstChild( lhs2 );
lhs2.setNextSibling( rhs2 );
op1.setNextSibling( op2 );
+
+ // "pass along" our initial embedded parameter node(s) to the first
generated
+ // sql fragment so that it can be handled later for parameter binding...
+ SqlFragment fragment = ( SqlFragment ) lhs1;
+ if ( lhsEmbeddedCompositeParameterSpecification != null ) {
+ fragment.addEmbeddedParameter( lhsEmbeddedCompositeParameterSpecification );
+ }
+ if ( rhsEmbeddedCompositeParameterSpecification != null ) {
+ fragment.addEmbeddedParameter( rhsEmbeddedCompositeParameterSpecification );
+ }
}
else {
AST op = getASTFactory().create( comparisonType, comparisonText );
Show replies by date