-->
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.  [ 5 posts ] 
Author Message
 Post subject: Querying for UserTypes
PostPosted: Tue Dec 28, 2004 1:46 pm 
Newbie

Joined: Thu Oct 09, 2003 4:06 pm
Posts: 16
Is there a way to query for UserTypes? I've got an enumerated type implemented as a UserType, and I'd like to be able to select them based on some criteria.

The idea is this:

The UserType is SecurityRight

a User has a Many-to-Many relationship with SecurityRight

a User has a Many-to-Many relationship with SecurityGroup

a User has a Many-to-Many relationship with SecurityRole

a SecurityRole has a Many-to-Many relationship to SecurityRight

a SecurityGroup has a Many-to-Many relationship to SecurityRole

a SecurityGroup has a Many-to-Many relationship to SecurityRight

I want to get the set of SecurityRights granted to a user from any of these sources (and did I mention there's another Many-to-Many from User to SecurityRight with specifically denied SecurityRights? I need to subtract those).

I'm having trouble writing an HQL to query for SecurityRights because it's not a mapped type. I've got a stored proc that will get the correct set, and I can get Hibernate to call it as a named SQL query, but I can't get it to map back to SecurityRight objects.

Any ideas?


Top
 Profile  
 
 Post subject: starting to get there
PostPosted: Tue Dec 28, 2004 2:38 pm 
Newbie

Joined: Thu Oct 09, 2003 4:06 pm
Posts: 16
I've started to get there with this. Here's what I've got so far:

select securityright from User user inner join user.securityRights securityright where user.id = :userId

gets the security rights specifically granted to this user.

select securityright from User user inner join user.securityRoles role inner join role.securityRights securityright where user.id = :userId

gets the security rights associated with the security roles.

But since HQL doesn't support UNION there's no way to stich all the pieces together...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 28, 2004 2:41 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Uhm, throw the results into the same Set?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 28, 2004 11:29 pm 
Newbie

Joined: Thu Oct 09, 2003 4:06 pm
Posts: 16
christian wrote:
Uhm, throw the results into the same Set?


I created a view instead and mapped a Many-to-Many Set to it. I think this is a good example of why UNION would be good to add to HQL though.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 29, 2004 12:30 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Post it as a feature request for H3.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.