ups... I need to explain something else...Notes has  int Id, object Relation

select f from Foo f, Note n where f.Id = n.Relation.id

"id" (lowercase) is a special property in HQL

2009/3/11 Fabio Maulo <[email protected]>

> Yes you canselect f from Foo f, Notes n where f.Id = n.RefId
>
> 2009/3/10 Daniel Crowe <[email protected]>
>
>
>> Hi Fabio,
>>
>> As I understand it, the <any> relation allows you to navigate from
>> Notes -> Foo, but I want to navigate the other way around.
>>
>> What do you think?
>>
>>
>> On Wed, Mar 11, 2009 at 12:48 AM, Fabio Maulo <[email protected]>
>> wrote:
>> > <any>
>> > http://nhforge.org/doc/nh/en/index.html#mapping-types-anymapping
>> >
>> > 2009/3/10 djc <[email protected]>
>> >>
>> >>
>> >> Hi All,
>> >>
>> >> I have a problem mapping our current DB in NHibernate and I am hoping
>> >> you can help me out.
>> >>
>> >> I have a number of table relationships that use discriminators to
>> >> point to different tables. Most of these can be mapped as inheritance
>> >> and are working fine, but I have some that are not so straight
>> >> forward:
>> >>
>> >> class Foo { int id; Note[] notes; }
>> >> class Bar { int id; Note[] notes; }
>> >> class Note { int id; datetime submitted; string content; }
>> >>
>> >> These are mapped using a common Notes table
>> >>
>> >> Notes: Id, RefType, RefId
>> >> were RefType is either "Foo" or "Bar" and RefId is the PK of either
>> >> Foo or Bar
>> >>
>> >> Is there a way to do this?
>> >> I have looked at combining filters with formulae but have had no
>> >> success.
>> >>
>> >> Can any one point me in a direction where I might find some info about
>> >> this?
>> >>
>> >> Thanks in advance,
>> >>  Daniel
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > Fabio Maulo
>> >
>> > >
>> >
>>
>> >>
>>
>
>
> --
> Fabio Maulo
>



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