2 Replies Latest reply on Jul 30, 2002 4:02 AM by tallyho

    EJB-QL and java.sql.Date in JBoss 3.0.0

    tallyho

      Hello, I'm running JBoss 3.0.0 and am trying to write an EJB-QL finder that looks like this:

      <query-method>
      <method-name>findErGyldigAvdeling</method-name>
      <method-params>
      <method-param>java.lang.Long</method-param>
      <method-param>java.sql.Date</method-param>
      <method-param>java.sql.Date</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(o)
      FROM EBOrganisasjonsStrukturLocal AS o
      WHERE o.underordnetOrgleddId = ?1
      and o.krigFredKode = 'F'
      and o.fraDato < ?2
      and (o.tilDato > ?3 or o.tilDato is null)]]>
      </ejb-ql>


      When this is deployed to JBoss, I get the following errormessage (i've included the preceding relevant few lines of debug statements):

      2002-07-29 15:59:44,974 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.EBOrganisasjonsStrukturLocal] Table not create as requested: ORGSTRU
      2002-07-29 15:59:44,974 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.EBOrganisasjonsStrukturLocal.findByPrimaryKey] SQL: SELECT ORLE_ORGL_ID_UNDERORDNET, KRIF_KRIG_FRED_K, FRA_DATO FROM ORGSTRU WHERE ORLE_ORGL_ID_UNDERORDNET=? AND KRIF_KRIG_FRED_K=? AND FRA_DATO=?
      2002-07-29 15:59:44,974 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.EBOrganisasjonsStrukturLocal] Added findByPrimaryKey query command for local home interface
      2002-07-29 15:59:44,974 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.EBOrganisasjonsStrukturLocal.findErGyldigAvdeling] EJB-QL:
      SELECT OBJECT(o)
      FROM EBOrganisasjonsStrukturLocal AS o
      WHERE o.underordnetOrgleddId = ?1
      and o.krigFredKode = 'F'
      and o.fraDato < ?2
      and (o.tilDato > ?3 or o.tilDato is null)


      2002-07-29 15:59:44,994 ERROR [org.jboss.ejb.EjbModule] Starting failed
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "<" at line 6, column 36.
      Was expecting one of:
      "=" ...
      "<>" ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46)

      It seems to me that the EJB-QL parsing assumes that the o.fraDato is a string. Can anybody tell me why this happens?

      As additional info, the database is Oracle 8.1.7 and the columns datatype is Date.

      P.S. All names are written in norwegian if you are wondering what they mean.

      Thanks