I'm setting up a system that has a collection of groups, users and modules. There exists a m2m relationship between groups-users, user-modules, and groups-modules. This allows someone to set the permissions by group, but add additional modules to a single user. I'm using association tables to acoomplish the m2m mappings.
Right now, I'm running two finds and I'm not sure this is the best approach. The first find ask for modules by userId, the second find asks for users by groupId. Both results are stored in a list and then converted into a set, to remove duplicates. I'm wondering if any has suggestions on a better way to do this? Do I need to restructure my schema, mod my hibernate code, or is this as good as it gets?
Cheers,
Tyler Pitchford
|