Using the References Association with a Class mapped with Where

6 views
Skip to first unread message

sternr

unread,
Aug 16, 2011, 9:49:32 AM8/16/11
to nhu...@googlegroups.com
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 all
Reply to author
Forward
0 new messages