have a look to <any> then you can use, probably, the new clause "with"For
<any> you may have
class Warning<T>
T Subject {get;set;}
To map a strongly typed Warning class you should use entity-name.

Using <any> you have two special properties
Subject.class and Subject.id (lowercase) and you can use it in the query.

2009/7/29 Kurt <[email protected]>

>
> 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
>
> >
>


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to