Hi,

Consider this EJB-QL..

SELECT OBJECT(o) FROM BaseTask AS o WHERE o.callID = ?1 OR
o.contact.surnameUpper = ?2 OR o.vehicle.registrationNumber = ?3 OR
o.orderNumber = ?4 OR o.address.postCode = ?5

In Jboss 3.0.8, the following SQL is generated...

SELECT t0_o.CALL_ID
FROM TASKS_BASE t0_o, TASKS_PART_VEHICLE t2_o_vehicle, TASKS_PART_CONTACT
t1_o_contact, TASKS_PART_ADDRESS t3_o_address
WHERE
 (t0_o.CALL_ID = ? OR t1_o_contact.SURNAME_UPPER = ? OR
t2_o_vehicle.REGNUMBER = ? OR t0_o.ORDER_NUM = ? OR t3_o_address.POSTCODE =
?)
 AND (t0_o.VEHICLE_ID=t2_o_vehicle.ID AND t0_o.CONTACT_ID=t1_o_contact.ID
AND t0_o.ADDRESS_ID=t3_o_address.ID)

..which is correct, but Jboss 3.2.2 generates the following SQL...

SELECT t0_o.CALL_ID
FROM TASKS_BASE t0_o, TASKS_PART_VEHICLE t4_o_vehicle, TASKS_PART_CONTACT
t2_o_contact, TASKS_PART_ADDRESS t7_o_address
WHERE (t0_o.CALL_ID = ?)
OR (t2_o_contact.SURNAME_UPPER = ? AND t0_o.CONTACT_ID=t2_o_contact.ID)
OR (t4_o_vehicle.REGNUMBER = ? AND  t0_o.VEHICLE_ID=t4_o_vehicle.ID)
OR (t0_o.ORDER_NUM = ?)
OR (t7_o_address.POSTCODE = ? AND  t0_o.ADDRESS_ID=t7_o_address.ID)

..which is incorrect, and returns incorrect results, due to not 'joining'
the tables correctly.

I can't get on to SF to see if this has been reported.

Phil


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to