3 Replies Latest reply on Sep 6, 2002 2:57 PM by vishal

    BETWEEN clause in EJBQL

    vishal Newbie


      <query-method>
      <method-name> ejbSelectCustomerByPhoneNos</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>

      </method-params>
      </query-method>
      <jboss-ql>
      <![CDATA[ SELECT OBJECT(cust) FROM cnCustomerSchema AS cust,IN(cust.phoneDetails) As phone WHERE phone.phone_Number BETWEEN ?1 AND ?2
      ORDER BY cust.cnCustomer ]]>
      </jboss-ql>


      i am passing 2 strings as parameters and i am getting this exception
      java.lang.IllegalArgumentException: object is not an instance of declaring class
      at java.lang.reflect.Field.get(Native Method)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.getPrimaryKeyValue(JDBCAbstractCMPFieldBridge.java:182)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.injectPrimaryKeyIntoInstance(JDBCEntityBridge.java:591)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:70)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:62)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:572)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:410)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.loadEntity(CachedConnectionInterceptor.java:353)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:262)

      i am using ejb3.0.2 and i looked inside JBossQLParser.jjt
      and found it allows string value
      void BetweenExpression() #Between :
      {}
      {
      (ArithmeticExpression() [ { jjtThis.not=true; } ]
      ArithmeticExpression() ArithmeticExpression())
      |
      (DatetimeValue() [ { jjtThis.not=true; } ]
      DatetimeValue() DatetimeValue())
      |
      (StringValue() [ { jjtThis.not=true; } ]
      StringValue() StringValue())
      }

      i am may be wrong in writing this ejbql