I attempted to use many-to-any. Unfortunately the "<set>" tag expects or infers a table attribute which in my case is multiple tables. Any way to work past it ?
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:28 AM To: Dhananjay Nene Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [Hibernate] Help : Bidirectionally Polymorphic One to Many associations Your solution would work. Alternatively, there is support for a "collection of anys". Use the (badly named) <many-to-any> tag. I think this is the best way for you. |---------+-------------------------------------------> | | Dhananjay Nene <[EMAIL PROTECTED]>| | | Sent by: | | | [EMAIL PROTECTED]| | | ceforge.net | | | | | | | | | 08/08/03 12:09 AM | | | | |---------+-------------------------------------------> >--------------------------------------------------------------------------- ---------------------------------------------------| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: [Hibernate] Help : Bidirectionally Polymorphic One to Many associations | >--------------------------------------------------------------------------- ---------------------------------------------------| I have the following scenario and have been unable to resolve the underlying issues by reading either the manual or the faq. <!-- The class names are contrived but the underlying relationships accurately reflect the problem I am trying to address --> I have two inheritance hierarchies. eg. Customer is a base class and InternalCustomer and ExternalCustomer are derived classes. Similarly Location is a base class whereas IndustrialLocation and CommercialLocation are derived classes. We have chosen to implement the table-per-concreteclass strategy (ie. each table has columns for the base class as well). So in a scenario where say an Invoice needs a reference to a customer, I have set up an "<any>" relationship from invoice to customer, by using customerType and customerId columns in the invoice table. However we need to setup a "one-to-many" relationship between a customer and a location (ie. polymorphic both ways with tables created for leaf classes only). This can be easily done at a table level by creating "customerType" and "customerId" columns in each of the location tables. I have also been able to be able to reference the customer object from a location object by using the "<any>" tag in the hbms of the location classes. I am unable to decide how to implement the relationship from customer to location using hibernate. I am looking for the ability to implement the "Set getLocations()" method in Customer. The following option does come to my mind (not certain if it is necessarily implementable) a. Implement getIndustrialLocations() and getCommercialLocations() seperately. This requires my customer class to not be able to deal with Locations polymorphically. Moreover it will require me to modify the source as and when I add new Derived classes for Location. I am however struggling for a better solution. Any suggestions will be welcome. Thanks Dhananjay ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ 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 sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel