1 Reply Latest reply on Sep 12, 2002 1:02 PM by Dain Sundstrom

    Between clause in JBossEJBQL

    vishal Newbie

      <method-name> ejbSelectCustomerByPhoneNos</method-name>

      <![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 ]]>

      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 defined in jbosscmp-jdbc.xml (this means ORDERBY is allowed here) 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

        • 1. Re: Between clause in JBossEJBQL
          Dain Sundstrom Master

          This is not a problem with the query, but a problem with you primary key class. Do you have a custom primary key class? Jboss is trying to extract a field from you primary key class, and the primay key object from which it is extracting the field is not same type as is declared in the ejb-jar.xml file. Are you using a sub class?