-->
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: Get data from "chained" n to m relationships
PostPosted: Fri May 25, 2012 2:45 pm 
Newbie

Joined: Fri May 25, 2012 2:28 pm
Posts: 2
Hi all
I'm new to hibernate, this is my first post.

I'm trying to do somethig that I don't know if it's posible, so please guide me:

I have a tables structure like this:
[User] -> [UserXRole] <- [Role] -> [RoleXOption] <- [Option]

UserXRole and RoleXOption are created because of the n to m association between Users-Roles and Roles-Options respectively.

From simple many-to-many asociations I can get the user roles and then iterating the user roles I can get the options.

I would like to know is there is a way to configure relationships/asociations to get the options of an user more "directly",
something like user.getOptions();

As an example of what I would like to do here is this pseudo SQL:
Select distinct O.name from User U inner join UserXRole UR inner join Role R inner join RoleXOption RO inner join Option O where U.id = ?


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.