-->
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: equi - joins with hibernate
PostPosted: Fri Nov 26, 2004 11:55 am 
Newbie

Joined: Thu Nov 11, 2004 3:24 pm
Posts: 17
I want to do a join of four tables and get the data

eg
SELECT
A.notice_id,
B.wss_tid ,
D.deal_number,
D.trade_date,
D.value_date
FROM
notice A,
xref_notice_customer B ,
favorite_notice C ,
ord_fx D
WHERE A.notice_id = B.notice_id
and A.notice_id = C.notice_id
and D.wss_tid = B.wss_tid
and C.siteminder_id = 'johndoe'
order by notice_id

In order to achieve this objective , would it be advisable to go in for hibernate query or a plain select using normal jdbc connection.

If hibernate is advisable can someone advice me how to do this.

If someone can explain me with a example , say in terms of emp and dept table. I want to select empno, ename , deptno and deptname by doing a join.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 26, 2004 5:24 pm 
Newbie

Joined: Thu Nov 11, 2004 3:24 pm
Posts: 17
The relation between the tables is such that

1) A user can have multiples favourite notices (favorite_notice table)
2) For each notice there are various customer (xref_notice_customer table). Customer and notice have one-one relation.
3) And for each customer there are various trades (ord_fx table)
4) And Notice table is the master table containing notice info

So in all i have 4 tables. As per the query stated in the earlier post, i am first trying to get all the favourite notices for the user 'johndoe' , then get the customer associated to each notice and then get teh trades associated to each customer. The basic objective is the get the trade details for each each notice associated to a user.

So in my query which would be the driving table and how do i go about writing the hibernate sql uery in my java code.


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.