Please use the user forum for such questions http://forum.hibernate.org
Bear Giles wrote:
Augh!
I have three classes with approximately a three-way many-to-many
relationship. Each "facility" can have multiple "contracts" and
"accounts." Each "contract" may serve multiple "facilities." For
modelling I can have each "account" have multiple "contracts" and
"facilities". That's easy to model with a join table with one-to-many
relationships with all three classes. BTW in the problem domain I'm
usually only looking at only two of the elements at any time.
In practice each account has one "facility" and one "contract." In
fact, the join table for the many-to-many facility x contract _is_ an
"account," in the problem domain. Aha, an obvious solution that
ensures domain semantics! - I just augment the join table with
additional fields.
Is it possible to do what I want to do? Specifically I would like to
have:
contract:
Set accounts (one-to-many, from accounts)
Set contracts (many-to-many, via accounts)
facility:
Set accounts (one-to-many, from accounts)
Set contracts (many-to-many, via accounts)
account:
Long accountId
Long contractId (many-to-one to contracts)
Long facilityId (many-to-one to facilities)
where both sets are properly handled by hibernate? Access methods can
ensure that all sets are properly updated, and I assume I would need
to set "update=false, insert=false" on the many-to-many sets.
All of my efforts today have resulted in either having contractId or
facilityId set not null, or artifically inserting an 'elt' field.
Thanks,
Bear
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel
--
Emmanuel Bernard
[EMAIL PROTECTED]
callto://emmanuelbernard
http://www.hibernate.org
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel