This list is for discussions involving the development of NHibernate rather
than its use.  Please post this to the NHUSERS group (
http://groups.google.com/group/nhusers).

Regards,

Steve Bohlen
[email protected]
http://blog.unhandled-exceptions.com
http://twitter.com/sbohlen


On Tue, Aug 16, 2011 at 9:28 AM, sternr <[email protected]> wrote:

> Hi,
>
> I have a legacy table storing multiple types of lookup objects, here's the
> table description:
> T_Lookup{ Id (key), object_type, object_id, description}
> Where Id is table key and the object_id is the unique key per the object
> type.
> All other tables use object_id as a foreign-key column and have no direct
> use of the id column of this table.
> So I tried mapping a Country lookup class from this table using object_id
> as the key column, and defined the following where: "object_type=10".
>
> While this works for direct queries, when I try to query over a different
> class that has a references association to this Country class it failes.
> Looking at the sql the query generated I see the Country where
> (object_type=10) is not used hence the association is not unique.
>
> Does the where attribute support associations? if so, what is the right way
> of doing it?
> Thanks!
>

Reply via email to