finder method in EJB-QL

Discussions

General J2EE: finder method in EJB-QL

  1. finder method in EJB-QL (1 messages)

    Hi,
    I have a problem related to executing an EJB-QL in EJB2.0 CMP EntityBean. (WebLogic 6.0 sp1.)

    There is a CMP EntityBean "SupplierBean" whose PrimaryKey is a String and the name defined in the ejb-jar.xml is "id".

    There is a EJB-QL as follows:
    <query>
       <query-method>
          <method-name>findByPrimaryKeys</method-name>
          <method-params>
             <method-param>java.lang.String</method-param>
          </method-params>
       </query-method>
       <ejb-ql>
          <![CDATA[FROM SupplierBean AS s WHERE s.id IN (?1)]]>
          <!--![CDATA[FROM SupplierBean AS s WHERE s.id IN ('100','101','102','103')]]-->
       </ejb-ql>
    </query>

    There is a corresponding method in "SupplierHome" interface
    public Collection findByIds(String idsInEJB_QLFromat) throws RemoteException, FinderException;

    When I pass "'100','101','102','103'" as an argument to the above method, it returns an empty Collection, whereas if I use the hardcoded query (which is commented above), it gives a proper result. (There are already EntityBeans in the datasource with the above ids).

    It looks pretty straight forward and can't figure out where the problem is. Can somebody help me over this?

  2. Hi ,
    The problem is that weblogic inturns put the 'code for the String arugument (ie)' '100','101''.
    U have to see the weblogic doc...