You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Michael Schulze <mi...@t-systems.com> on 2003/06/16 16:42:38 UTC
Problem with Criteria and Alias
Hello List,
I have a problem with a PB query and aliases for joined tables. I build
a criteria like this to join the vehicle table with the equipment table
twice:
criteria1.addEqualTo("vehicleEquipments.code", "580");
criteria1.setAlias("EQUIPEMNT1");
criteria2.addEqualTo("vehicleEquipments.code", "U11");
criteria2.setAlias("EQUIPEMNT2");
criteria3.addAndCriteria(criteria1);
criteria3.addAndCriteria(criteria2);
the resulting query fails because of the assigned aliases of the joined
equipment tables. From the p6spy log:
SELECT A0.VEHI_RELEASE_TS, ...
FROM (V0QRVEHI A0 INNER JOIN V0QRVEEQ A1 ON A0.VEHI_KEY=A1.VEEQ_VEHI_KEY)
INNER JOIN V0QRVEEQ A2 ON A0.VEHI_KEY=A2.VEEQ_VEHI_KEY
WHERE ( A3.VEEQ_CODE = '580' ) AND (A2.VEEQ_CODE = 'U11' )
the FROM clause uses A1 and A2 as aliases for the equipment tables where
as the JOIN clause uses A2 and A3. It works fine if i don't assign an
alias to criteria1.
Is there anything i do wrong or is this a bug in OJB?
I use 1.0 rc3 with jdk 1.4.1.
Thanks,
Michael