-->
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: Quaternary Associations
PostPosted: Sat Jan 08, 2005 3:59 pm 
Newbie

Joined: Sat Jan 08, 2005 3:40 pm
Posts: 7
Location: New York
Hello Hibernator-folk,

I'd like your collective opinion on how to deal with a quaternary association.

This is the ERD.

Code:
+-----------------------------+------------------------+
|TABLE                        |ENTITY                  |
+-----------------------------+------------------------+
|tblUsers                     |User                    |
|tblUserGroups                |UserGroup               |
|tblWebEntities               |WebEntity               |
|tblWebEntityGroups           |WebEntityGroup          |
+-----------------------------+------------------------+
|tblUserGroupAssignments      |UserGroupAssignment     |
|tblWebEntitypGroupAssignments|WebEntityGroupAssignment|
+-----------------------------+------------------------+


The first four entities are the ones I'm interested in. If these entities were directly related to each other via a single association table, I'd simply use four composites, with each composite containing references to the other three entities in the association.

But two of these objects (UserGroups and WebEntityGroups) are related through their own respective association tables (tblUserGroupAssignments and tblWebEntitypGroupAssignments). And so I've created additional entities (UserGroupAssignment and WebEntityGroupAssignment) to map these tables to use in the composites.

And now for my questions...

How do I deal with UserGroup and WebEntityGroup? For example, if I query User I'll get back a list of User objects, and each User object has a set of composite objects that--in turn--contain three associated sets (UserGroupAssignment, WebEntity, and WebEntityGroupAssignment). What is the best way to reference UserGroup from UserGroupAssignment and WebEntityGroup from WebEntityGroupAssignment? Keep in mind I'll also be going the other way, querying UserGroup to see what Users, WebEntities, and WebEntityGroups are associated with any particular UserGroup. I'm uncertain how to map UserGroup or WebEntityGroup so that I can go the other way, through their respective association tables to the quaternary association table.

Here are some mappings to further illustrate...

This is a mapping for User showing the composite-element tag in action...

This is a mapping for a composite object (PermissionAssignmentForUser) used by User to reference the other three objects in the quaternary association (i.e., UserGroupAssignment, WebEntity, and WebEntityGroupAssignment)...

This is a mapping for the object representing one of the association tables involved in the quaternary association...

I hope this isn't hopelessly confusing; let me know and I'll redo it all using foo, bar, snafu, and fumanchu. An easier way to sum up everything would be to simply ask: how do I deal with entities that are indirectly related in a quaternary association through their own respective association tables?

If you've read this far then you certainly deserve my gratitude. THANK YOU!

-S


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.