RowValueConstructorSyntax with In syntax is not working
-------------------------------------------------------
Key: HHH-6856
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6856
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 4.0.0.CR6
Reporter: Strong Liu
Assignee: Strong Liu
Fix For: 4.0.0.next
_org.hibernate.test.hql.HQLTest#testRowValueConstructorSyntaxInInList_ fails on oracle.
because this HQL "from LineItem l where l.id in
(('a1',1,'b1'),('a2',2,'b2'))" is not correctly
parsed.
it throws the following exception:
{quote}
16:43:59,245 DEBUG QueryTranslatorImpl:252 - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (LineItem)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
| +-[SELECT_EXPR] SelectExpressionImpl: 'lineitem0_.customerId as customerId30_,
lineitem0_.orderNumber as orderNum2_30_, lineitem0_.productId as productId30_'
{FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy
properties,classAlias=l,role=null,tableName=LineItem,tableAlias=lineitem0_,origin=null,columns={,className=LineItem}}}
| \-[SQL_TOKEN] SqlFragment: 'lineitem0_.quantity as quantity30_'
+-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=1,
fromElements=1, fromElementByClassAlias=[l], fromElementByTableAlias=[lineitem0_],
fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: 'LineItem lineitem0_'
FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy
properties,classAlias=l,role=null,tableName=LineItem,tableAlias=lineitem0_,origin=null,columns={,className=LineItem}}
\-[WHERE] SqlNode: 'where'
\-[IN] InLogicOperatorNode: 'in'
+-[DOT] DotNode: '(lineitem0_.customerId, lineitem0_.orderNumber,
lineitem0_.productId)'
{propertyName=id,dereferenceType=2,propertyPath=id,path=l.id,tableAlias=lineitem0_,className=LineItem,classAlias=l}
| +-[ALIAS_REF] IdentNode: '(lineitem0_.customerId, lineitem0_.orderNumber,
lineitem0_.productId)' {alias=l, className=LineItem, tableAlias=lineitem0_}
| \-[IDENT] IdentNode: 'id' {originalText=id}
\-[IN_LIST] SqlNode: 'inList'
+-[VECTOR_EXPR] SqlNode: '{vector}'
| +-[QUOTED_STRING] LiteralNode: ''a1''
| +-[NUM_INT] LiteralNode: '1'
| \-[QUOTED_STRING] LiteralNode: ''b1''
\-[VECTOR_EXPR] SqlNode: '{vector}'
+-[QUOTED_STRING] LiteralNode: ''a2''
+-[NUM_INT] LiteralNode: '2'
\-[QUOTED_STRING] LiteralNode: ''b2''
16:43:59,249 DEBUG ErrorCounter:82 - throwQueryException() : no errors
16:43:59,252 ERROR ErrorCounter:54 - <AST>:0:0: unexpected AST node: {vector}
16:43:59,254 ERROR ErrorCounter:50 - <AST>:0:0: unexpected AST node: {vector}
<AST>:0:0: unexpected AST node: {vector}
at org.hibernate.hql.internal.antlr.SqlGeneratorBase.inList(SqlGeneratorBase.java:3155)
at
org.hibernate.hql.internal.antlr.SqlGeneratorBase.exoticComparisonExpression(SqlGeneratorBase.java:2965)
at
org.hibernate.hql.internal.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1219)
at
org.hibernate.hql.internal.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:857)
{quote}
I think the key is here
{code:title=sql-gen.g}
inList
: #(IN_LIST { out(" "); } ( parenSelect | simpleExprList ) )
;
simpleExprList
: { out("("); } (e:simpleExpr { separator(e," , "); } )* {
out(")"); }
;
// A simple expression, or a sub-select with parens around it.
expr
: simpleExpr
| #( VECTOR_EXPR { out("("); } (e:expr { separator(e," , "); } )* {
out(")"); } )
| parenSelect
| #(ANY { out("any "); } quantified )
| #(ALL { out("all "); } quantified )
| #(SOME { out("some "); } quantified )
;
{code}
fromt this grammar, inList doesn't accept VECTOR
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira