-->
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: HQL can't select BINARY_CHECKSUM()
PostPosted: Tue Nov 27, 2012 10:35 am 
Newbie

Joined: Wed Oct 21, 2009 2:31 am
Posts: 7
Hello,

I have a case sensitiv problem and we use MS SQL.

I'd like to do something like
Code:
VALUE IN (SELECT VALUE ......

But this check has to be case sensitiv. I've found an SQL-Function that works, but not in HQL.
Kind of:
Code:
BINARY_CHECKSUM(VALUE) IN (SELECT BINARY_CHECKSUM(VALUE) ......


I've tried:
Code:
FROM WochenplanZusatzcodeDB _WochenplanZusatzcodeDB WHERE BINARY_CHECKSUM(_WochenplanZusatzcodeDB.zeichen)=?

It works without a problem but if i do
Code:
SELECT BINARY_CHECKSUM(_WochenplanZusatzcodeDB.zeichen) FROM WochenplanZusatzcodeDB _WochenplanZusatzcodeDB


Following exception happens:
Code:
Caused by: java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: '('
    +-[METHOD_NAME] IdentNode: 'BINARY_CHECKSUM' {originalText=BINARY_CHECKSUM}
    \-[EXPR_LIST] SqlNode: 'exprList'
       \-[DOT] DotNode: 'wochenplan0_.ZEICHEN' {propertyName=zeichen,dereferenceType=ALL,propertyPath=zeichen,path=_WochenplanZusatzcodeDB.zeichen,tableAlias=wochenplan0_,className=ch.siaxma.hibernate.data.WochenplanZusatzcodeDB,classAlias=_WochenplanZusatzcodeDB}
          +-[ALIAS_REF] IdentNode: 'wochenplan0_.TAB_ID' {alias=_WochenplanZusatzcodeDB, className=ch.siaxma.hibernate.data.WochenplanZusatzcodeDB, tableAlias=wochenplan0_}
          \-[IDENT] IdentNode: 'zeichen' {originalText=zeichen}

   at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:157)
   at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:827)
   at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:632)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:685)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
   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:124)


Why doesn't it work? What do i do wrong?

Thanks for helping
Gepi


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.