-->
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: Incorrect HQL to SQL conversion when using position()
PostPosted: Wed Aug 08, 2012 2:31 pm 
Newbie

Joined: Wed Aug 08, 2012 1:11 pm
Posts: 1
I am trying to sort the output of select statement based on the substring value in the column 'name'.
Here’s my HQL query.

2012-08-08 18:08:14,453 DEBUG - [org.hibernate.hql.internal.ast.QueryTranslatorImpl] :HQL: from com.emc.mnsvc.component.tag.Tag order by substring(name,0,position('X' in name))

After conversion SQL has no parameters in position()

2012-08-08 18:08:14,453 DEBUG - [org.hibernate.hql.internal.ast.QueryTranslatorImpl] :SQL: select tag0_.id as id24_, tag0_.description as descript2_24_, tag0_.name as name24_, tag0_.readOnly as readOnly24_ from mnsvc.Tag tag0_ order by substring(tag0_.name, 0, position())

This causes the SQL execution to fail.

Expected output if command were to work:
psql -d mnsvcDB -c "select * from tag order by substring(name,0,position('X' in name));"

id | name | readonly | description
----+----------------+----------+-------------
1 | VNX_domain_101 | t |
(1 row)

I can provide a full trace if that helps. Wanted to quickly check if this is a known issue and if is workaround.

Thanks,
Juzar.


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.