4 Replies Latest reply on Feb 26, 2004 9:39 AM by Erik Sliman

    jboss support EJB QL??

    dennislee Newbie

      HI

      i encounter a problem like this

      ...
      <ejb-ql>
      <![CDATA[SELECT OBJECT (a) FROM mytable AS a WHERE a.age >=?1 AND a.count <=?2]]>
      </ejb-ql>
      ...

      when i deploying it on jboss322 it tell me

      org.jboss.deployment.DeploymentExceptin: Error compiling EJB-QL statement 'SELECT OBJECT (a) FROM mytable AS a WHERE a.age >=?1 AND a.count <=?2'; - nested throwable : (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered ">" at line 1, column 56)

      WHY???

      please help me !

      --my jboss server version is 3.23 jdk 1.4



        • 1. Re: jboss support EJB QL??
          ebaskoro Newbie

          G'Day,

          Unfortunately, EJB-QL does not support >= and <= operators. You may use JBossQL to overload the query string.

          Or you can specify it as

          SELECT OBJECT (a) FROM mytable AS a WHERE ( a.age > ?1 OR a.age = ?1 ) AND ( a.count < ?2 OR a.count = ?2 )

          • 2. Re: jboss support EJB QL??
            dennislee Newbie

            thank you very much

            but if the field type is TDateTime (in DataBase) ,how can i map it to JBOSS? to String type or to java.sql.Date ? or to java.sql.Timestamp??
            and how can i write such as following (in EJb-QL)

            SELECT OBJECT(a) FROM mytable AS a WHERE mydate >= ?1 AND mydate <= ?1


            help me

            • 3. Re: jboss support EJB QL??
              lrodrigu19 Newbie

              Try This:

              (a.startDate > ?1 OR a.startDate = ?1) AND (a.endDate < ?2 OR a.endDate = ?2)

              Larry

              • 4. Re: jboss support EJB QL??
                Erik Sliman Apprentice

                 

                if the field type is TDateTime (in DataBase) ,how can i map it to JBOSS? to String type or to java.sql.Date ? or to java.sql.Timestamp??


                I use MySQL, and the defaults work. I also have instance in jbosscmp-jdbc where I have the following, which may be the same as the default:

                 <cmp-field>
                 <field-name>logoutTime</field-name>
                 <column-name>logoutTime</column-name>
                 <jdbc-type>TIMESTAMP</jdbc-type>
                 <sql-type>DATETIME</sql-type>
                 </cmp-field>