-->
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: named sql-query with join
PostPosted: Tue May 03, 2005 1:19 pm 
Beginner
Beginner

Joined: Fri Feb 04, 2005 2:44 pm
Posts: 25
Location: Buffalo, NY
Hello

I am trying to use a named sql query that is a table join. How do I do this? Do I need a mapping for each of the tables used in the query? Ideally, I'd just like to have a java class that holds the 4 columns that are returned. I read the docs on this topic, but there aren't enough examples. I don't know what classes I need. I don't know what an "alias" is. I just want to run this SQL statement, and the results in a object. Thanks in advance!

My named sql-query:

<sql-query name="maxWeekPerForm">
<return alias="fw" class="FormAndWindow"/>
<![CDATA[
select A.study, E.fname, D.winunt, D.winval
from table1 A
join table2 B on A.id = B.id
join table3 C on C.id = B.id
join table4 D on D.id = C.id
join table5 E on E.id = E.id
where D.winval in
(
select max(winval)
from table4 F
where F.id = D.id
)
group by A.study, E.fname, D.winunt, D.winval
order by A.study, E.fname, D.winunt, D.winval
]]>
</sql-query>


Top
 Profile  
 
 Post subject: did you get it to work properly?
PostPosted: Fri May 13, 2005 11:32 am 
Newbie

Joined: Fri Apr 22, 2005 10:40 am
Posts: 9
Hello

did you get it to work properly?


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.