Can I implement this as this?

Leave Address as a interface.
Class ToAddress--- mapped to address with type='t'
class CCAddress---mapped to Address with type='c'
Then in Class has two sets
toaddr---- mapped to a list of ToAddress
ccaddr----mapped to a list of CCAddress

Althought I did not try, but it should work.

jason




--- [EMAIL PROTECTED] wrote:
> 
> Nup, it's not allowed currently. It would probably
> be pretty trivial to
> support in the same way we support the order-by
> attribute ... simply have a
> where attribute of a collection mapping. If you want
> to try implementing
> that, please feel welcome since many people have
> asked for this. Currently
> each collection requires its own foreign key column.
> 
> I am not so keen on this kind of model, actually.
> 
> 
> 
>                                                     
>                                                     
>                             
>                     "Aapo Laakkonen"                
>                                                     
>                             
>                     <[EMAIL PROTECTED]>
>        To:    
> <[EMAIL PROTECTED]>             
>              
>                     Sent by:                        
>        cc:                                          
>                             
>                    
> [EMAIL PROTECTED]       Subject:    
> [Hibernate] How to do this (assiciation)?           
>         
>                     eforge.net                      
>                                                     
>                             
>                                                     
>                                                     
>                             
>                                                     
>                                                     
>                             
>                     13/02/03 02:16 AM               
>                                                     
>                             
>                     Please respond to aapo.laakkonen
>                                                     
>                             
>                                                     
>                                                     
>                             
>                                                     
>                                                     
>                             
> 
> 
> 
> 
> 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
> 
> 
> 
> 
>
**********************************************************************
> Any personal or sensitive information contained in
> this email and
> attachments must be handled in accordance with the
> Victorian Information
> Privacy Act 2000, the Health Records Act 2001 or the
> Privacy Act 1988
> (Commonwealth), as applicable.
> 
> This email, including all attachments, is
> confidential.  If you are not the
> intended recipient, you must not disclose,
> distribute, copy or use the
> information contained in this email or attachments. 
> Any confidentiality or
> privilege is not waived or lost because this email
> has been sent to you in
> error.  If you have received it in error, please let
> us know by reply
> email, delete it from your system and destroy any
> copies.
>
**********************************************************************
> 
> 
> 
> 
> 
>
-------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
>
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Reply via email to