-->
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: native SQL queries in hibernate don't work when using alias
PostPosted: Wed Jun 22, 2011 2:02 am 
Newbie

Joined: Mon Oct 11, 2010 3:44 am
Posts: 2
I have a problem :

if you do something like this:
Code:
select
oldForm.data as oldData
newForm.data as newData
from
form oldForm,
join form newForm on oldForm.replaced_by_id = newForm.id

then use entityManager.createNativeQuery(sql).getResultList()


it will end up with an error that says column named oldData does not exist. If you take out the aliases, then it will just return the first value for "data" for every column. If you run this through straight JDBC with the alias, it works as expected.

The same issue is given at http://opensource.atlassian.com/projects/hibernate/browse/HHH-4174

Is there a solution to it??
Thanks to help..its urgent..


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.