0 Replies Latest reply on Aug 17, 2005 11:05 PM by Upul Godage

    ejb sql complex OR AND gives no results

    Upul Godage Newbie

      Hi,

      This query gives results.

      SELECT OBJECT(o) FROM GEN_ORDER o WHERE
       (
       (
       (o.serviceCode = ?1)
       AND
       (o.transitTime.fromZone = ?2)
       AND
       (o.transitTime.toZone = ?3)
       )
       ) OFFSET ?4 LIMIT ?5


      serviceCode, transitTime, fromZone etc are all local EJBs.

      Following one ORs the above with another condition set in brackets. But this does not give any results, though it should give at least the above sql returned records.

      SELECT OBJECT(o) FROM GEN_ORDER o
       WHERE
       (
       (
       (o.serviceCode = ?1)
       AND
       (o.transitTime.fromZone = ?2)
       AND
       (o.transitTime.toZone = ?3)
       )
       OR
       (
       (o.serviceCode = ?4)
       AND
       (o.dataReturnTime.fromZone = ?5)
       AND
       (o.dataReturnTime.toZone = ?6)
       )
       ) OFFSET ?7 LIMIT ?8


      Here in the second condition set dataReturnTime, fromZone etc are also local EJBs.

      Query params etc. are all correct and the query executes but no results.
      Why when ORing ANDed conditions give no results?

      Please help.