-->
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: Complex Nested SQL query and DAO/DTO model
PostPosted: Tue Mar 29, 2005 3:22 am 
Newbie

Joined: Sun Dec 19, 2004 8:10 pm
Posts: 10
Location: Australia
Hi all,

I am writing an interface to a database and need some help with a nested query I have the following tables

Fguser
Fguserrole
Role
layerrole
layer
sessiontoken

these are mapped as follows :

layer -one-to-many- layerrole-many-to-one-role-one-to-many-fguserrole-many-to-one-fguser-one-to-many-sessiontoken

I have the sessiontokenId and I want to get the layers for the user, In SQL I would do this :


Code:


SELECT DISTINCT l.*
      FROM layer_role lr, layer l
     WHERE lr.layer_id = l.layer_id       
     AND lr.role_id IN ( SELECT fr.role_id
                                                  FROM fguser_role fr, sessiontoken st
                          WHERE fr.fguser_id = st.fguser_id
              AND st.session_id = '?')


I am a little stuck as to how to implement this in Hibernate. We are currently using the DAO DTO model.

Any help appreciated

Connie


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.