FindBy method in CMP

Hi
I would like to know if there is a way of get case insensitive results
from database using CMP findBy methods ?
Thanks
Lavanya

In CMP, we don't want to or can not send queries directly to the database. The EJB container manages the O.R. mapping. It is likely the relational structure of your beans is unknown.
We also can not assume the database he or she is using has the capacity to create materialized views.

Similar Messages

  • NoSuchMethodError in EJBHomeImpl.findBy() methods

    Hi All,
    I've searched all past entries relating to java.lang.NoSuchMethodError, but most
    responses have suggested mere typo errors or, at most, the presence of multiple
    jars during deployment. I've checked that this is not what happens to my BMP,
    but I still get the NoSuchMethodError in my EJBHomeImpl.findBy() method when the
    generated code reaches the
    weblogic.ejb.internal.MethodInfo __mi = findMethodInfo(__methodSig);
    line.
    I also ran the beanManaged example and it ran fine. I've done several rebuilds,
    most involving cleaning out all compiled classes and jar related to my project.
    I'm using Weblogic 5.1 SP8 on Windows NT 4 SP 4.
    Any help would be appreciated.
    Thanks,
    Boogie

    Hi Sean,
    Simple solution.
    Run a search in ur computer with the name of ur home interface's .class file.
    That ll display all the places where ur home interface .class files are stored(there are certain folders in the server where is gets stored secretly.: - ) ).
    Then go to individual location and delete the .class files.
    make all the editions u have to in ur bean class and ur home interface.
    compile using build again.Hope u achieve ur objective now. ; - )
    Regards
    Chatni

  • FindBy method for reference entities

    hi,
    I have created an entitity(Relation) which contains references of other 2 entities(address, person).I have created findBy methods(FindByCity,FindByLastName,etc) in Relation entity for attributes in those refernce entities(Address-city,state)(Person-First name, Last Name). but while i'am testing these functions it says :
    <b>ERROR. setFilter column(25): Undefined expression 'personRef_var.refObject.name'</b>
    I'am not able to decipher this error message. can anyone help me about what could possibly be wrong in the code generated. the following is the code containing this reference :-
    if ("addressRef".equals(attrName))
    if (subAttrName == null)
       resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.AddressRefVO");
                             resQueryFilter.setCollectionAttribute("addressRef");
                             resQueryFilter.setAttribute("addressRef_var.refObject.key");
    else
         strParamName = subAttrName;
         dotIndex = strParamName.indexOf('.');
         attrName = (dotIndex == -1) ? strParamName : strParamName.substring(0, dotIndex);
         subAttrName = (dotIndex == -1) ? null : strParamName.substring(dotIndex + 1, strParamName.length());
         resQueryFilter = new com.sap.caf.rt.bol.util.IntQueryFilter((com.sap.caf.rt.bol.util.QueryFilter) qf);
                             resQueryFilter.setAttribute("addressRef_var.refObject." + strParamName);
    } else if ("personRef".equals(attrName))
    if (subAttrName == null)
    {                         resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.PersonRefVO");
                             resQueryFilter.setCollectionAttribute("personRef");
                             resQueryFilter.setAttribute("personRef_var.refObject.key");
    else
         strParamName = subAttrName;
         dotIndex = strParamName.indexOf('.');
         attrName = (dotIndex == -1) ? strParamName : strParamName.substring(0, dotIndex);
         subAttrName = (dotIndex == -1) ? null : strParamName.substring(dotIndex + 1, strParamName.length());
         resQueryFilter = new com.sap.caf.rt.bol.util.IntQueryFilter((com.sap.caf.rt.bol.util.QueryFilter) qf);
         resQueryFilter.setAttribute("personRef_var.refObject." + strParamName);

    Hi Pamita,
    Generation is errorneous for related entities which do not have relations at all. This problem emerges when you searching by some specific attribute of related entity.
    The following workarounds:
    1. Create a fake relation for Person and Address entities. For example you can create relation from Person to Person.
    2. Change generation template. I don't remember template name - it should be like ServiceBean.
    the following fix in generated coding should work:
    <code>
    if ("addressRef".equals(attrName))
    if (subAttrName == null)
    resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.AddressRefVO");
    resQueryFilter.setCollectionAttribute("addressRef");
    resQueryFilter.setAttribute("addressRef_var.refObject.key");
    else
    strParamName = subAttrName;
    dotIndex = strParamName.indexOf('.');
    attrName = (dotIndex == -1) ? strParamName : strParamName.substring(0, dotIndex);
    subAttrName = (dotIndex == -1) ? null : strParamName.substring(dotIndex + 1, strParamName.length());
    resQueryFilter = new com.sap.caf.rt.bol.util.IntQueryFilter((com.sap.caf.rt.bol.util.QueryFilter) qf);
    resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.AddressRefVO");
    resQueryFilter.setCollectionAttribute("addressRef");
    resQueryFilter.setAttribute("addressRef_var.refObject." + strParamName);
    } else if ("personRef".equals(attrName))
    if (subAttrName == null)
    { resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.PersonRefVO");
    resQueryFilter.setCollectionAttribute("personRef");
    resQueryFilter.setAttribute("personRef_var.refObject.key");
    else
    strParamName = subAttrName;
    dotIndex = strParamName.indexOf('.');
    attrName = (dotIndex == -1) ? strParamName : strParamName.substring(0, dotIndex);
    subAttrName = (dotIndex == -1) ? null : strParamName.substring(dotIndex + 1, strParamName.length());
    resQueryFilter = new com.sap.caf.rt.bol.util.IntQueryFilter((com.sap.caf.rt.bol.util.QueryFilter) qf);
    { resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.PersonRefVO");
    resQueryFilter.setCollectionAttribute("personRef");
    resQueryFilter.setAttribute("personRef_var.refObject." + strParamName);
    </code>
    Be carefull while changing template because this generated piece of coding is used in many places.
    Best regrads,
    Aliaksei

  • Is it possible to create findBy method for collection of ids?

    subj -
    I have a set of ids (HashSet of Integers).
    is it possible to create such findBy method which retrieves group of entity beans with ids specified in the set?

    You could do something like:
    PrimKeyBean
    public PrimKey ejbSelectPrimKey(Long key) throws FinderException;
    public Collection getPrimKeys(Collection keyset) {
      try{
        Vector output = new Vector();
        Iterator it = keyset.iterator();
        while(it.hasNext()){
          output.add(ejbSelectPrimKey((Long)it.Next()));
        return output;
      } catch (FinderException fe) {}
    ...deploymentdescriptor.ejb
    <query>
    <query-method>
    <method-name>ejbSelectPrimKey</method-name>
    </query-method>
    <ejb-ql>
    SELECT OBJECT(o) FROM pkTable o WHERE pkTablePK = ?1
    </ejb-ql>
    </query>
    ...client
    Collection c = primKey.getPrimKeys(keyset);
    ...

  • FindBy method naming rules

    What are the rules for naming the findBy methods?
    I want to find entity Bean by two fields. e.g. Want find entity Bean on orderNumber and customerId field.
    I created method like findByOrderNumberAndCustomerId(String orderNumber, String customerId)
    It let me generate code and deploy the bean, but at runtime it does not return any entity bean or Collection. It throws exception.
    Thanks for your help.
    A

    There is no problem with your method name, I think if u could post the code, it will be better.
    or try using EJB QL for searching as
    public Animal findbyId(int Id){
    return (Animal) em.createQuery("Select e From Animal e where e.id = :id").setParameter("id",Id).getSingleResult();
    }

  • FindBy() Method finds the same bean more than once

    I am desperate.
    Can anyone at least tell me if they ever heard of a problem similar to this in a CMP Entity Bean?
    PROBLEM: My findByMemberOrHash(MemberLocal, String) method returns a Collection with FOUR references to the same Entity Bean from a table that has only one Entity Bean persisted in it!
    Yet, my findByMember(MemberLocal) and findByHash(String) both work perfectly and return a Collection with only one element -- the single Entity Bean in the table.
    Here is the relevant code and table info:
    My Entity Beans are named LoggedIn and are persited in a MySql table named loggedings that has but 3 columns:PK:         PrimaryKey (Integer).
    HASH:       persistance field (String).
    members-pk: relationship field (Foreign Key to Member Bean table (Integer)For this test the table persisted a single Bean. Here is the data base SELECT:mysql> SELECT * FROM loggedins;
    +----+------+------------+
    | PK | HASH | members_pk |
    +----+------+------------+
    | 40 | X    |          1 |
    +----+------+------------+
    1 row in set (0.00 sec)Here is my logger output from the server:
    LoggerBean is a Session bean that is processing the login.
    To test, I had it run three findBy()s ... Member Or Hash, Member Only, and Hash OnlyINFO  [LoggerBean] Print out findByMemberOrHash()
    INFO  [LoggerBean] 0:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean] 1:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean] 2:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean] 3:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean]
    INFO  [LoggerBean] Print out findByMember()
    INFO  [LoggerBean] 0:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean]
    INFO  [LoggerBean] Print out findByHash()
    INFO  [LoggerBean]  0:   LoggedInBean: PK(40) Hash(X) Member_pk(1)I am lost for any ideas.
    Its too trivial a test to break it down any further.
    Especially since the single parameter SELECTs work perfectly.
    Here is my ejb-jar.xml code:<query>
         <query-method>
              <method-name>findByMemberOrHash</method-name>
                <method-params>
                  <method-param>
                    org.america3.go.server.ejb.entity.MemberLocal
                  </method-param>
                  <method-param>
                    java.lang.String
                  </method-param>
              </method-params>
         </query-method>
         <ejb-ql>
              SELECT OBJECT(c) FROM LoggedInSchema c
              WHERE c.members_pk = ?1 OR c.hash = ?2
         </ejb-ql>
    </query>

    I am desperate.
    Can anyone at least tell me if they ever heard of a problem similar to this in a CMP Entity Bean?
    PROBLEM: My findByMemberOrHash(MemberLocal, String) method returns a Collection with FOUR references to the same Entity Bean from a table that has only one Entity Bean persisted in it!
    Yet, my findByMember(MemberLocal) and findByHash(String) both work perfectly and return a Collection with only one element -- the single Entity Bean in the table.
    Here is the relevant code and table info:
    My Entity Beans are named LoggedIn and are persited in a MySql table named loggedings that has but 3 columns:PK:         PrimaryKey (Integer).
    HASH:       persistance field (String).
    members-pk: relationship field (Foreign Key to Member Bean table (Integer)For this test the table persisted a single Bean. Here is the data base SELECT:mysql> SELECT * FROM loggedins;
    +----+------+------------+
    | PK | HASH | members_pk |
    +----+------+------------+
    | 40 | X    |          1 |
    +----+------+------------+
    1 row in set (0.00 sec)Here is my logger output from the server:
    LoggerBean is a Session bean that is processing the login.
    To test, I had it run three findBy()s ... Member Or Hash, Member Only, and Hash OnlyINFO  [LoggerBean] Print out findByMemberOrHash()
    INFO  [LoggerBean] 0:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean] 1:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean] 2:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean] 3:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean]
    INFO  [LoggerBean] Print out findByMember()
    INFO  [LoggerBean] 0:   LoggedInBean: PK(40) Hash(X) Member_pk(1)
    INFO  [LoggerBean]
    INFO  [LoggerBean] Print out findByHash()
    INFO  [LoggerBean]  0:   LoggedInBean: PK(40) Hash(X) Member_pk(1)I am lost for any ideas.
    Its too trivial a test to break it down any further.
    Especially since the single parameter SELECTs work perfectly.
    Here is my ejb-jar.xml code:<query>
         <query-method>
              <method-name>findByMemberOrHash</method-name>
                <method-params>
                  <method-param>
                    org.america3.go.server.ejb.entity.MemberLocal
                  </method-param>
                  <method-param>
                    java.lang.String
                  </method-param>
              </method-params>
         </query-method>
         <ejb-ql>
              SELECT OBJECT(c) FROM LoggedInSchema c
              WHERE c.members_pk = ?1 OR c.hash = ?2
         </ejb-ql>
    </query>

  • How to implement find methods in CMP?

    As OC4J does not support EJB-QL, we need to implement the find methods by ourselves. But how? Here is my thought.
    1) Still declare the find methods in EJB home, such as
    public Collection findBySponsor(String sponsorGuid);
    2) Do not add query part to ejb-jar.xml file;
    3) In the bean class, implement the find method using JDBC code.
    Does CMP allows explicit-implementation of finder methds?
    Does CMP allows explicit-call to JDBC code?
    Thanks,

    Henry -- Why go to that trouble? For the near term I would suggest that you just modify the generated
    orion-ejb-jar.xml descriptors which will include tags to allow you to either 1) enter a partial criteria or
    2) enter a complete SQL statement. This is much less work and when EJB-QL is available with the product,
    then you have to only add the EJB-QL to the ejb-jar.xml.
    Thanks -- Jeff

  • Finder methods for CMP beans

    We do not implement finder method in Bean class for CMP. As such, where do we implement finder methods such as findInRange() method? How does the container implement my custom "find" methods.
    Thanks

    Using CMP 2.x, your custom finder and select methods are implemented by the container based on the EJB QL query you provide in the ejb-jar.xml. In CMP 1.1, there was no portable way to express the semantics of the query, so most vendors had a vendor-specific syntax for describing the query.
    See chapter 27 of the J2EE 1.4 Tutorial for some examples of using EJB QL :
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
    --ken
    Kenneth Saks
    J2EE SDK Team
    SUN Microsystems

  • Binary Data Type in finder methods for CMP beans

    How to write an equivalent ejb-ql query in ejb-jar.xml for a finder method accepting
    a byte array as a parameter. The finder method is for a cmp-field mapped to a
    database field with binary data type

    Using CMP 2.x, your custom finder and select methods are implemented by the container based on the EJB QL query you provide in the ejb-jar.xml. In CMP 1.1, there was no portable way to express the semantics of the query, so most vendors had a vendor-specific syntax for describing the query.
    See chapter 27 of the J2EE 1.4 Tutorial for some examples of using EJB QL :
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
    --ken
    Kenneth Saks
    J2EE SDK Team
    SUN Microsystems

  • Problem with findAll method in CMP

    I have successfully deployed the CMP entity bean and am testing the findAll method
    when I reaslised that the result returned to the collection is limited to 100
    records, although I have 150 records in the database.
    When I restarted the WLS and ran the test again, the first time I ran findAll,
    it returned 150 records. But when I ran it a second time, it was limited to 100
    again. It seems that the findAll method only works on the first time after I restart
    the WLS.
    Any idea what could be wrong? I am using WLS6.1 and the EJBQL is as follows:
    FROM UnitsEBean var
    Any help would be appreciated. Thanks.
    Chris

    The setting for max heap size is dependent on how your application behaves.
    If you create alot of small temporary objects and you use a large heap size
    such as 512mb then when the full garbage collection runs in the JVM your
    application is completely suspended while GC runs. In practice I have seen
    this take upwards of 15 seconds or more at 512MB. If you have this problem
    you also likely have memory leaks (implicit references to onbjects left
    around) so that the GC does not free up this memory. In practice I have
    experienced better results by running more weblogic instances with smaller
    JVMs than running few weblogic instances with large JVMs.
    The sun Java site has alot of useful documentation on tuning the JVM.
    Francis Sommers
    "Cameron Purdy" <[email protected]> wrote in message
    news:3c1a8284$[email protected]..
    Up your max beans in cache to 10000.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    Tangosol Coherence: Clustered Coherent Cache for J2EE
    Information at http://www.tangosol.com/
    "Chris Yeo" <[email protected]> wrote in message
    news:3c19e569$[email protected]..
    I have successfully deployed the CMP entity bean and am testing thefindAll method
    when I reaslised that the result returned to the collection is limited
    to
    100
    records, although I have 150 records in the database.
    When I restarted the WLS and ran the test again, the first time I ranfindAll,
    it returned 150 records. But when I ran it a second time, it was limitedto 100
    again. It seems that the findAll method only works on the first time
    after
    I restart
    the WLS.
    Any idea what could be wrong? I am using WLS6.1 and the EJBQL is asfollows:
    FROM UnitsEBean var
    Any help would be appreciated. Thanks.
    Chris

  • Using wildcards in custom find methods with CMP beans

    Hi,
    I'd like to create a custom find method called findByName which accepts a string. I'd typically want to use the string in a '%<name>%' scenario, where the user needn't type in the whole name. Does anybody know what the partial query should look like? I'm not sure how to concatenate the '%' symbol to the string taken in.
    Thanks in advance
    Gillian

    Gillian-
    Bind variables are of the form $1, $2, etc., so try using a query stmt like this:
    select * from YOURTABLE where name like '%$1%'
    Regards,
    -Jon

  • Help with findByDateRange method in CMP enity bean

    Hello,
    I am trying to deploy my entity beans to WebLogic 7, runnning on a Sun Solaris
    box. The application connects to an Oracle 9i database. I am having problems with
    2 queries in my ejb-jar.xml file which correspond to 2 finder methods. These finder
    methods take two java.util.Date parameters. I have read that EJB QL does not support
    dates or date literals in its WHERE clause and one has to use long values of these
    dates. I tried various combinations but haven't been able get the query to work.
    Here is an excerpt from my ejb-jar.xml file
    <query>
    <query-method>
    <method-name>findBySalesOrderID</method-name>
    <method-params>
    <method-param>java.lang.Long</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    SELECT OBJECT(c) FROM Equipment c
    WHERE c.salesOrderID = ?1
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findEquipmentByStagingDateRange</method-name>
    <method-params>
    <method-param>java.util.Date</method-param>
    <method-param>java.util.Date</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[
    SELECT OBJECT(c) FROM Equipment c
    WHERE c.equipReqStageDate >= ?1 AND c.equipReqStageDate <= ?2
    ]]>
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-params>
    <method-param>java.util.Date</method-param>
    <method-param>java.util.Date</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[
    SELECT OBJECT(c) FROM Equipment c
    WHERE c.equipReqShipDate >= ?1 AND c.equipReqShipDate <= ?2
    ]]>
    </ejb-ql>
    </query>
    Do I have to change the method parameters to java.lana.Long or to 'long' literal
    from java.util.Date?
    Here is the finder method signature in the home interface
    public java.util.Collection findEquipmentByStagingDateRange(java.util.Date begDate,
    java.util.Date engDate) throws javax.ejb.FinderException, java.rmi.RemoteException;
    public java.util.Collection findEquipmentByShippingDateRange(java.util.Date begDate,
    java.util.Date engDate) throws javax.ejb.FinderException, java.rmi.RemoteException;
    Do I have to pass in Dates or java.lang.Longs or 'long' literals?
    Any help is really appreciated. Thanks.
    [question.txt]

    Did you try java.sql.Date?
    /k
    "John Carson" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hello,
    I am trying to deploy my entity beans to WebLogic 7, runnning on a SunSolaris
    box. The application connects to an Oracle 9i database. I am havingproblems with
    2 queries in my ejb-jar.xml file which correspond to 2 finder methods.These finder
    methods take two java.util.Date parameters. I have read that EJB QL doesnot support
    dates or date literals in its WHERE clause and one has to use long valuesof these
    dates. I tried various combinations but haven't been able get the query towork.
    Here is an excerpt from my ejb-jar.xml file
    <query>
    <query-method>
    <method-name>findBySalesOrderID</method-name>
    <method-params>
    <method-param>java.lang.Long</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    SELECT OBJECT(c) FROM Equipment c
    WHERE c.salesOrderID = ?1
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findEquipmentByStagingDateRange</method-name>
    <method-params>
    <method-param>java.util.Date</method-param>
    <method-param>java.util.Date</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[
    SELECT OBJECT(c) FROM Equipment c
    WHERE c.equipReqStageDate >= ?1 AND c.equipReqStageDate <= ?2
    ]]>
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-params>
    <method-param>java.util.Date</method-param>
    <method-param>java.util.Date</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[
    SELECT OBJECT(c) FROM Equipment c
    WHERE c.equipReqShipDate >= ?1 AND c.equipReqShipDate <= ?2
    ]]>
    </ejb-ql>
    </query>
    Do I have to change the method parameters to java.lana.Long or to 'long'literal
    from java.util.Date?
    Here is the finder method signature in the home interface
    public java.util.Collection findEquipmentByStagingDateRange(java.util.DatebegDate,
    java.util.Date engDate) throws javax.ejb.FinderException,java.rmi.RemoteException;
    >
    public java.util.CollectionfindEquipmentByShippingDateRange(java.util.Date begDate,
    java.util.Date engDate) throws javax.ejb.FinderException,java.rmi.RemoteException;
    >
    Do I have to pass in Dates or java.lang.Longs or 'long' literals?
    Any help is really appreciated. Thanks.

  • Problem with traverse method

    Hi, I am having this problem:
    I made a CustomItem, a TextField, now I overloaded the traverse method, so if the keycode is Canvas.UP or Canvas.DOWN then return false else return true.
    The problem is that when I press the left or rigth button it also returns false and not true.
    and there is another problem with traverse, before returning false or true I set a boolean and call to repaint to draw it on some way if its selected or not, the paint method is being called but it just dont draw as desired.
    protected void paint(Graphics g, int ancho, int alto) {
              System.out.println ("Dentro del paint, seleccionado="+seleccionado);
              try {
                   g.drawString(label, 0, 0, Graphics.TOP|Graphics.LEFT);
                   if (!seleccionado) {
                        g.setColor(120, 120, 120);
                   g.drawRect(0, 4, tama�oTexto+8, 25);
                   if (seleccionado) {
                        g.setColor(255, 255, 255);
                        g.fillRect(1, 5, (tama�oTexto+8-1), 23);
                   g.setColor(0, 0, 0);
                   if (!seleccionado) {
                        g.setColor(80, 80, 80);
                   g.drawString(texto, 4, 7, Graphics.TOP|Graphics.LEFT);
                   if (seleccionado) {
                        int cursorX=Font.getDefaultFont().charsWidth((texto.substring(0, idLetraActual)).toCharArray(), 0, texto.substring(0, idLetraActual).length())+4;
                        g.drawChar('|', cursorX, 7, Graphics.TOP|Graphics.LEFT);
              } catch (Exception E){
                   E.printStackTrace();
         }the traverse method set the seleccionado variable and calls to repaint but instead of being false the paint method is drawing it as true (most of times).

    I have a problem with findByxxx() method.. in
    Container managed bean.
    i have
    Collection collection =
    home.findByOwnerName("fieldValue");
    specified in my Client Program, where ownerName is the
    cmp fieldname..
    and
    public Collection findByOwnerName(String ownerName)
    throws RemoteException, FinderException
    defined in my home interface.
    i have not mentioned the findBy() method anywhere else
    (Bean class). You have to describe the query in the deployment descriptor.
    >
    Even if i have a same "fieldValue" in the database
    (Oracle), which i specified in findBy() method, iam a
    result of owner Not found, which is not the case as i
    have that owner name.
    for the same application if i use findByPrimaryKey(),
    it is working..
    Can any one please post me the solution.

  • Find by methods

    I am doing some programming with CMP where i have one findBy Method , which is returning a Collection, By the way i have couple of get/set methods defined in the Bean implementation class , i need to access the get methods of which , kindly let me know how to do i access those from the client code !!! Do i need to declare those methods in the Remote interface ?
    Thanks
    Mathew

    EmployeeRemote
    employee_remote=(EmployeeRemote)PortableRemoteObject.na
    row(it.next(),EmployeeRemote.class);
    System.out.println("Id"+ employee_remote.getId());---------------------------------------------------------
    Wrong!!
    Object ref = ctx.lookup("jndiName");
    EmployeeHome employee_home = (EmployeeHome) PortableRemoteObject.narrow(ref, EmployeeHome.class);
    EmployeeRemote employee_remote = employee_home.create(....);
    String name = employee_remote.getName() <--- getXXX method
    You first lookup the jndi name to obtain a reference to the ejb. Then you narrow it down to the HOME INTERFACE TYPE!!! You can invoke create[if you want to create a new row in the database] or call findByPrimaryKey [if you want a remote reference to an existing row].
    Once you get the remote reference , you can invoke the getXXX/setXXX methods on it. Have a look at the J2EE tutorial for a step by step procedure.
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/J2eeTutorialTOC.html
    Cheers
    Kindly let me know if i am calling a right code --
    Thanks
    Mathew

  • Overloaded finder method allowed?

    Hi,
    Is it allowed to overload finder method in EJB CMP other than the findByPrimaryKey? Thank you

    The number of parameters and their types define overloaded method names.
    <query> <description></description> <query-method> <method-name>findBy<></method-name> <method-params> <method-param></method-param> <method-param></method-param> </method-params> </query-method> <ejb-ql></ejb-ql> </query>

Maybe you are looking for

  • Is there a way to view the color profile(s) of a PDF document in Acrobat Reader X (10)?

    Or, do you have to use the full version of Acrobat to view these?

  • Dropbox Using Memory on iPhone 5c

    Hi all, I have just seen under settings->general->usage->manage storage that my Dropbox is using up 440MB of memory on my iPhone 5c. I thought all of the files are stored in the cloud? Does anyone have any suggestions on how to clear this amount of d

  • Asset management -related to sd

    Dear Member, I want to in the case of sale of assets how it is to be done in SAP SD. I will be oblige if somebody will provide me the material relating to create order type and billing type for sale of assets. Thanks & Regards, Trinath

  • (JS] (CS2) AppliedObjectStyle

    Hello everyone, I was wondering how I could OVERWRITE all properties of the ObjectStyle? At the moment, it is applying but NOT overwriting!!! myPasteBox.appliedObjectStyle.defaultTextObjectStyle = app.objectStyles.item('[Normal Text Frame]'); myPaste

  • Installing Oracle Database 10g R2 on Red hat linux 4

    by following the guide of installation problem in the Following step Configuring the Oracle Users Enviroment Open the Oracle user shell startup file in any text editor problem is how to open and path of this file then Enter or edit the following line