-->
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.  [ 2 posts ] 
Author Message
 Post subject: "from table t1, table t2, table t3..." have proble
PostPosted: Tue May 23, 2006 11:03 am 
Newbie

Joined: Tue May 23, 2006 5:28 am
Posts: 2
dear all
i have a legacy system, so i need write some sql command,
i execute sql from mysql shell mode, i can get correct result

"unit1 level1 type1 city1" <-it's correct

but when i use hibernate session.createSQLQuery(sql).list()

i got this

"unit1 level1 level1 level1" <-it's different!!!!

i use the same sql command, but i got the different result
What am I doing wrong?


sql is
select
u.unitname, c1.subdesc, c2.subdesc, c3.subdesc
from
unit u, commentd c1, commentd c2, commentd c3
where
c1.maincode='UnitLevel' and c1.subcode=u.unitlevel
and c2.maincode='UnitType' and c2.subcode=u.unittype
and c3.maincode='CityNo' and c3.subcode=u.cityno"

Hibernate version:3.1.3
database:mysql 5


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 9:14 pm 
Newbie

Joined: Tue May 23, 2006 5:28 am
Posts: 2
sorry
i have modify the sql command, it can work correctly

select
u.unitname, c1.subdesc as a, c2.subdesc as b, c3.subdesc as c
from
unit u, commentd c1, commentd c2, commentd c3
where
c1.maincode='UnitLevel' and c1.subcode=u.unitlevel
and c2.maincode='UnitType' and c2.subcode=u.unittype
and c3.maincode='CityNo' and c3.subcode=u.cityno


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.