-->
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 operator priority
PostPosted: Wed May 26, 2010 12:04 pm 
Newbie

Joined: Wed May 26, 2010 11:53 am
Posts: 1
Hi guys,

I recently started to use hibernate and hql and have one question. Hql magically rearranges brackets considering operator priority. It seems it is not always correct. For example, i have such query
Code:
session.createQuery(
            "from Node as node " +
            ",ImportedContentNode as icn " +
            "where node.nid=icn.nid and " +
            "icn.unifiedTitle like (? + '%')")
.setString(0, unifiedTitle)
.list();

In mysql console syntax
Code:
... like (? + '%')
is correct and without brackets is incorrect. But hql omits brackets, so resulting query looks like
Code:
... where node0_.nid=importedco1_.nid and (importedco1_.unified_title like ?+'%')


Do you have any suggestions or workarounds for such case?
TIA


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.