Let's say I have a Message table:
message (id, subject, content, toaddr, ccaddr)

- id = long identifier
- subject = text string
- content = text string
- toaddr = mapping to a address table with address.type='t'.
- ccaddr = mapping to a address table with address.type='c'.

Or it can be an integer or anything else... maybe an enumeration.

And I have a table Address:
address (id, message_id, email, type)

- id = long identifier
- message_id = long foreign key relation to message table
- email = text string
- type = type that identifies the type of this address field (to-address
or cc-address).

I'd like to to mapping so that my Message class looks something like
this:

public class AddressBean implements Serializable {
        private long id;
        private String subject;
        private String Content;
        private Set toaddr;
        private Set ccaddr;
}

- Each message has zero to many to-addresses.
- Each message has zero to many cc-addresses.
- Each address belongs to exactly one message.

How do I write a mapping for that? Hibernate needs to somehow know that
we are mapping toaddr set to address table that has a particular
address.message_id and address.type.


Kind Regards
Aapo Laakkonen



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Reply via email to