-->
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: Where is the best place to store many to many relationships
PostPosted: Tue Jun 01, 2010 3:56 pm 
Newbie

Joined: Wed Apr 14, 2010 4:33 pm
Posts: 8
Hello all,
I was wondering where the best place to create many to many relationships was? Fro example if I have something like
Code:
   public class permission()
   {
        permission()
        {
               user = new HashSet<User>();
               categories = new HashSet<Categories>();
        }
   }


is that better than doing something in the DAO like (and leaving the many to many relationship out of the permission class)
Code:
      List<Permission> getPermissionsForUser(Long id)
      {
              //get permissions for the user from the many to many table and return that as a list
       }


This is more of a which design is better question. If for example there is a permission like canUpdateContractPhone which doesn't apply to the categories then having an empty hashSet doesn't seam as effective as searching for the results and returning it from a DAO pattern. Or am I completely off?


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.