why not <joined-subclass> ? On Thu, Dec 2, 2010 at 7:20 PM, Hendry Luk <[email protected]> wrote:
> Yes, in this case, because Employee has association to Company, and also > other properties. Is there any other way to achieve that other than > <subclass><join>? > > > On Thu, Dec 2, 2010 at 11:32 PM, Fabio Maulo <[email protected]> wrote: > >> are you using <subclass>+<join> for some special reasons ? >> >> On Thu, Dec 2, 2010 at 6:45 AM, Hendry Luk <[email protected]> wrote: >> >>> Hello, >>> Is there any way to make one-many bag association from an entity to a >>> subclass (with join)? >>> Just an isolated example: >>> >>> <class name="Person"> >>> <!-- blah blah --> >>> <discriminator column="PersonType" /> >>> </class> >>> >>> <subclass name="Employee" discriminator-value="Employee"> >>> <!-- blah blah --> >>> <join table="Emplooyee"> >>> <key column="PersonId" /> >>> <many-to-one name="Company" column="CompanyId" class="Company" /> >>> </join> >>> </subclass> >>> >>> <class name="Company"> >>> <!-- blah blah --> >>> <bag name="Employees"> >>> <key column="CompanyId" /> ---------------> this fails >>> <one-to-many class="Employee" /> >>> </bag> >>> </class> >>> >>> That bag will fail because it will seek CompanyId under Person table, >>> instead of from the Employee table, which is understantable. But my question >>> is if it's possible to achieve what I am going for. I cannot use >>> joined-subclass, because in my real case (NotificationPolicy base-class), >>> most of the subclasses don't have additonal properties (only different >>> behavior), hence discriminnator column is more appropriate. Only in certain >>> subclass do I need to join with another table for additional properties, but >>> in NHibernate I'm not allowed to mix subclass and joined-sublass on the same >>> inheritance hierarchy. >>> Does anyone have any solution or workaround to make the above example >>> work? >>> >>> Thanks >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "nhusers" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<nhusers%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/nhusers?hl=en. >>> >> >> >> >> -- >> Fabio Maulo >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
