-->
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 doesn't seem to support alias in select statement.
PostPosted: Fri May 21, 2010 12:05 pm 
Regular
Regular

Joined: Thu Apr 14, 2005 10:39 am
Posts: 115
Hi, I just want to query the name attributes of two tables.

Code:
Select l.name, so.name
from  countrymodel as l, unternehmensmodell as um, unternehmensmodellvst as umvst, steuerdaten as sd, steuerobjekt as so
where l.unternehmensmodell_id = um.id
and um.nachsteuerum_id = umvst.id
and umvst.steuerdatenunt_id = sd.id
and so.steuerdate_id = sd.id


But it returns l.name twice, instead of l.name, so.name.

What's wrong? How can I solve it.

By the way i can't use HQL, cause my web-frontend is designed for Sql only.

Thanks a lot.

Greetings Michael

PS: I'm using Hibernate 3.5.2 with PostgresSql 8.4.
Without hibernate the query works fine.

PPS:

Quote:
Select l.name, so.name as steuername
from countrymodel l, unternehmensmodell as um, unternehmensmodellvst umvst, steuerdaten sd, steuerobjekt so
where l.unternehmensmodell_id = um.id
and um.nachsteuerum_id = umvst.id
and umvst.steuerdatenunt_id = sd.id
and so.steuerdate_id = sd.id


Works, but why doesn't hibernate like the first one?


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.