3 Replies Latest reply on Aug 18, 2002 3:36 PM by Dain Sundstrom

    dynamic-ql

    vishal Newbie

      Has any one tried to implement crimeportal example (specially ejbHomeSelectInStates method) given with the jBoss 3.0 documentation.
      I tired to implement same stuff but jboss is throwing ejbql.ParseException exception.
      I have implemeted same code by defining ejbSelectGeneric both in ejb-jar.xml(making empty ejb-ql entry) and jbosscmp-jdbc.xml(defining method as <dynamic-ql/>)
      in the bean i passed the dynamic sql String with the array of the parameters to ejbSelectGeneric method
      I think i have just changed the names of schema and parmeters inside the sql.
      thats what jboss does on this
      13:58:06,850 DEBUG [ejbSelectGeneric] DYNAMIC-QL: SELECT OBJECT(o) FROM cnConstantSchema AS o WHERE o.cnConstant IN(?1 , ?2 , ?3 , ?4 , ?5)
      13:58:06,866 ERROR [STDERR] javax.ejb.FinderException: Error compiling ejbql: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "o.cnConstant" at line 1, column 53.
      Was expecting one of:
      "NOT" ...
      <STRING_VALUED_PATH> ...
      <COLLECTION_VALUED_PATH> ...
      "(" ...
      "CONCAT" ...
      "SUBSTRING" ...
      "UCASE" ...
      "LCASE" ...
      <BOOLEAN_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <VALUE_CLASS_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <IDENTIFICATION_VARIABLE> ...
      <NUMERIC_VALUED_PATH> ...

      13:58:06,881 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.execute(JDBCDynamicQLQuery.java:74)
      13:58:06,881 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCSelectorBridge.execute(JDBCSelectorBridge.java:64)
      13:58:06,881 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:95)
      13:58:06,881 ERROR [STDERR] at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)

        • 1. Re: dynamic-ql
          Dain Sundstrom Master

          What type is o.cnConstant? Does cnConstantSchema have a field named cnConstant? What verion of JBoss are you using?

          • 2. Re: dynamic-ql
            vishal Newbie

            o.cnConstant is defined as <cmp-field> and is specified inside CNCONSTANT entity bean definition both in ejb-jar and jbosscpw-jdbc.xml
            my ejb-jar.xml and jbosscmp-jdbc.xml looks like this

            ejb-jar.xml

            <ejb-name>uk.co.isesolutions.apps.ccd.cnconstant.entity.CnConstant</ejb-name>
            <local-home>.......................
            <abstract-schema-name>cnConstantSchema</abstract-schema-name>
            <cmp-field><field-name>cnConstant</field-name></cmp-field>
            <cmp-field><field-name>activeFlg</field-name></cmp-field>
            <cmp-field><field-name>usedFlg</field-name></cmp-field>
            <cmp-field><field-name>cnConstant_Link</field-name></cmp-field>

            <query-method>
            <method-name>ejbSelectGeneric</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            <method-param>java.lang.Object[]</method-param>
            </method-params>
            </query-method>
            <ejb-ql/>





            jbosscmp-jdbc.xml

            <ejb-name>uk.co.isesolutions.apps.ccd.cnconstant.entity.CnConstant</ejb-name>
            <table-name>CNCONSTANT</table-name>
            <read-only>true</read-only>
            <cmp-field>
            <field-name>cnConstant</field-name>
            <column-name>CNCONSTANT</column-name>
            <sql-type>NUMBER(12)</sql-type>
            </cmp-field>
            <cmp-field>
            <field-name>activeFlg</field-name>
            <column-name>ACTIVE_FLG</column-name>
            <sql-type>VARCHAR2(1)</sql-type>
            </cmp-field>
            <cmp-field>
            <field-name>usedFlg</field-name>
            <column-name>USED_FLG</column-name>
            <sql-type>VARCHAR2(1)</sql-type>
            </cmp-field>
            <cmp-field>
            <field-name>cnConstant_Link</field-name>
            <column-name>CNCONSTANT_LINK</column-name>
            <sql-type>NUMBER(12)</sql-type>
            </cmp-field>


            <query-method>
            <method-name>ejbSelectGeneric</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            <method-param>java.lang.Object[]</method-param>
            </method-params>
            </query-method>
            <dynamic-ql/>
            <read-ahead>on-load</read-ahead>





            i am using jboss-3.0.1RC1 version

            • 3. Re: dynamic-ql
              Dain Sundstrom Master

              I suggest you start by upgrading to 3.0.1 final, but I don't think that will fix the problem. There is something weird in the configuration files. If you can't fix it, post a bug report along with a reproducible test case.