Ignore that quote of mine. Late on a Friday isn't always the optimal time to ask me java stuff. If you had asked me a beer related question, I'd have put some more thought into it... ;)
The main disadvantage of having one list per role is that you need to do some major reworking to add a new role. If you added a "guest" user type, then you'd need a third set of users. You'd also have to put some work into validating a folder when saving it, to ensure that a user isn't both a guest and an admin. If you had only one list of users, and put the users' access rights to each folder in the user-to-folder link table, then a simple uniqueness constraint would do that for you. Though of course, your schema allows you to do that already, so that's good.
If you model the link table as a separate class, then you'd get the best of all worlds, I think:
Code:
TABLE PERSON
PERSON_ID
TABLE ROLE
ROLE_ID
ROLE (valid roles include admin, guest, owner, etc.)
TABLE FOLDER
FOLDER_ID
TABLE PERSON_FOLDER_ROLE
PERSON_ID
FOLDER_ID
ROLE_ID
The person and folder mappings both would include a set of roles. Maybe something along these lines:
Code:
<mapping name="Person" ...>
<set name="FolderRoles" class="FolderRole" table="PERSON_FOLDER_ROLE" ...>
<key column="PERSON_ID"/>
<composite-element>
<many-to-one name="Role" class="Role"/>
<many-to-one name="Folder" class="Folder"/>
</composite-element>
</set>
...
</class>
If a ternary relationship like that isn't appropriate, a set of many-to-many FolderRoles will also work, but then you may run into issues with mapping a table twice, once in each direction (because FolderRoles and PersonRoles will both use the PERSON_FOLDER_ROLE table).
Hmm, apparently first thing on Monday doesn't find me at my best, either. I don't suppose you have a coffee-related question? ;)