-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate bug in row value constructor syntax
PostPosted: Mon Feb 08, 2010 7:14 am 
Newbie

Joined: Mon Apr 14, 2008 2:01 pm
Posts: 4
Hi,

Hibernate version: 3.3.2 GA

I'm 99% sure I've discovered a bug in hibernate's row value constructor syntax. Following SQL statement (Oracle) is going to cause an exception:

Code:
select *
from some_table t
where t.date_like_field = :some_value


, where t.date_like_field is being replaced by "(extract(year from t.some_date), extract(month from t.some_date)" (noop component)

An Exception:
Code:
Caused by: org.hibernate.HibernateException: SqlNode's text did not reference expected number of columns
   at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.extractMutationTexts(BinaryLogicOperatorNode.java:198)
   at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.mutateRowValueConstructorSyntax(BinaryLogicOperatorNode.java:118)
   at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.mutateRowValueConstructorSyntaxesIfNecessary(BinaryLogicOperatorNode.java:94)
   at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.initialize(BinaryLogicOperatorNode.java:74)
   at org.hibernate.hql.ast.HqlSqlWalker.prepareLogicOperator(HqlSqlWalker.java:1133)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4189)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1792)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)
   at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
   at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
   at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
   at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
   at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)


And the culprit imho is the following line of code [ org.hibernate.hql.ast.tree.BinaryLogicOperatorNode (Line 196) ]:
Code:
String[] splits = StringHelper.split( ", ", nodeText );


I can only assume that somebody thought 'StringHelper.split' works the same way as 'String#split', whereas the former accepts string with separators as an argument and the latter accepts regex as a separator.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.