This problem has been fixed in the latest CVS sources as far as I can tell.

There have been a number of messages about this problem and their various workarounds in the past month, so just have a hunt around the mail archives.

HTH,

Michael

Charles Anthony wrote:
Hi,

Ah, I see - I smell a bug then.

Smile and wave nicely at Jakob; he's the Query guru.

Sorry I couldn't be of any more help.

Cheers,

Charles.


-----Original Message-----
From: Michael Schulze [mailto:[EMAIL PROTECTED]
Sent: 17 June 2003 07:03
To: OJB Users List
Subject: RE: Problem with Criteria and Alias



Do you simply want all vehicles (?) with

vehicleEquipments.code 580 or U11 ?


I want all vehicles that have a vehicleEquipments.code '580' and a
vehicleEquipments.code 'U11'. there is a 1:n relationship between
vehicle and equipment


Looking at your extract of code, and your extract from the

spy log, OJB


seems to be doing exactly what you've asked it to.

the resulting sql in the spy log is exactly what i want, except for the aliases (A0-A3) in the FROM clause don't match the aliases in the WHERE clause and i get a syntax error.

thanks,
Michael


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.



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates.

At present the integrity of email across the internet cannot be guaranteed
and messages sent via this medium are potentially at risk. All liability
is excluded to the extent permitted by law for any claims arising as a re-
sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to