Ahh sorted. select w from Warning as w, Person as p where w.record_id = b.id and b.something = whatever
On Jul 29, 3:47 pm, Kurt <[email protected]> wrote: > Hi, > I have 3 entities. Person, Image, and Warning. Now a Warning (or > several Warnings) can be associated with either a single Person, or a > single Image. > > In the mapping file, the Warning is declared like: > <property column="RECORD_ID" type="Int32" access="field" > name="record_id" not-null="true" /> > > In the actual db table, record_id references the primary key of either > the Person table, or the Image table, depending on the value in other > column/property. At the DB level there is no explicit FK relationship > either. > > I get an error with a hql like: > from Warning as w > inner join Person as p > where w.RecordId = p.Id > and p.Something = Whatever; > > "outer or full join must be followed by path expression" > > I assume it is because there is no relationship defined in the mapping > for nh to make sense of the join or the "where w.RecordId = p.Id" bit. > > So I have two questions. > > 1. Is there a quick way to use hql, or even sql to get the Warning I > want? and > 2. Out of curiosity what would be the correct way to model such a > situation where one entity can have either of two different types of > parent? > > Thanks > Kurt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
