2 Replies Latest reply on Feb 3, 2006 7:16 AM by fmagrini72

    EJB-QL with date comparison

    fmagrini72

      Hi friends,
      In my app I have a CMP Entity Bean representing an exchange rate at a specific date.
      I created a select methos with following query:

      SELECT MAX(o.date) FROM ExchangeRate o WHERE o.listino.id=?2 AND o.currency.id=?2 AND o.date<=?3

      Third parameter is a java.util.Date type

      This method always returns a null value.
      I'm using mySQL as DBMS.
      Where am I wrong?
      Thanks a lot.
      Filippo

        • 1. Re: EJB-QL with date comparison

          Hi Filippo,

          have you set the correct parameter in your query? You wrote:

          ... o.listino.id=?2 AND o.currency.id=?2 ...


          You have twice the ?2 but and no ?1.

          We use a select query with a date without any problems. Its like:

          SELECT OBJECT(o) FROM aEntity AS o WHERE o.eDate=?1

          Regards
          Marco

          • 2. Re: EJB-QL with date comparison
            fmagrini72

            Hi Marco,
            thank you very very very much!!!!!!
            I stressed myself and others for a so stupid solution!!!!!!!
            Thanks a lot.
            Filippo