XMLs for Deploying the entity bean with compound key.

Discussions

EJB programming & troubleshooting: XMLs for Deploying the entity bean with compound key.


  1. Hi ,
    I am working with an entity bean(CMP) . Here i need to use a compound key in my custom key class. Due to some circumstances I am deploying the bean manually by generating the three XML files needed for the deployment i.e.
    ejb-jar.xml
    weblogic-cmp-jar.xml
    weblogic-cmp-rdbms-jar.xml
    The problem i am facing is in the weblogic-cmp-rdbms-jar.xml . I am not able to figure out a way to describe a finder method in this file.

    The method has been declared as follows in the CampaignHome
    interface.

    public Campaign findByPrimaryKey(campaignPK key) throws FinderException,RemoteException;

    The key is made up of ( String Year, int emp_id ).


    I am writing it like....
    ........
    .......
    <finder-list>
      <finder>
        <method-name>findByPrimaryKey</method-name>
          <method-params>
           <method-param>what to write HERE </method-param>
          </method-params>
         <finder-query>What to write here</finder-query>
      </finder>
    </finder-list>
    ..............
    .............

    This is giving me errors while deployment.
    Can anybody help me to sort this problem. Am I missing something here.

    Thanking in advance,
    Vinod.
  2. Vinod,
    Very quickly
    How to define a finder in WL:

    <finder-list>
    <finder>
    <method-name>findAmountsGreaterThan</method-name>
    <method-params>
    <method-param>double</method-param>
    </method-params>
    <finder-query>
    <![CDATA[ (> amount $0)]]>
    </finder-query>
    </finder>
    </finder-list>

    Remember that you have to define that finder method with the same args and types in your ejb Home like the following:

    public Enumeration findAmountsGreaterThan(doubleamountGreaterThan)
    throws FinderException, RemoteException;