Top level collections are what I thought of using at first but I have a
need for long transactions.  I read in the doc that sess.update(obj) can
not be called on objects with top level collection elements

Person contains a Collection of Address objects
Customer contains a collection of Address objects
Vendor contains only one Address object
Address contains a collection of Phone objects

All three classes would refer to the same table instead of
PERSON_ADDRESS, 
PERSON_ADDRESS_PHONE ,
CUSTOMER_ADDRESS, 
CUSTOMER_ADDRESS_PHONE,
put all the Address fields in the VENDOR table
VENDOR_PHONE.

The database itself does not implement referential integrity for
portability issues, all referential integrity checking will be left to
the application's persistence layer.

Instead of the bunch of tables above the database would contains the
following tables:
PERSON
CUSTOMER
VENDOR
ADDRESS
PHONE

In the mapping file, I'm looking at doing something like the following:
(will if fly?)

Person & Customer  class mappings
    <set role="addresses" 
                   cascade="all" 
                   lazy="true">
                        <key column="PARENT_KEY"/>
                        <one-to-many column="pkg.Address"/>
    </set>

------------------------------------------------------------------------
-
Vendor class mapping
    <many-to-one name="address"
                             class="pkg.Address"
                             column="ADDRESS_KEY"/>

------------------------------------------------------------------------
-
Address class mapping
    <set role="phones" 
            table="phone" lazy="true">
                        <key column="PARENT_KEY"/>
                        <one-to-many class="pkg.Phone"/>
    </set>
------------------------------------------------------------------------
-
Thank you.





-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to