CMP and Finder methods

I've got a table:
id number primary key,
name varchar2(50),
price number
How can i make finderXXX for this sql query:
select * from table where name like 'beer' and price > 10;
Thank's

gday Max -
For this, you'll need to make some a slight modification to the generated finder methods.
Say you create an entity called Drinks which has the same structure as the table you provide as an example (and can I just say, what a great example you chose ;)
It should go something like this - note, I've not tried this but this is what you need to look at doing:
In the Home interface (DrinksHome) create a findermethod that looks like:
public Collection findByName(String name, Double Price) throws RemoteException, FinderException;
* note we make the return type a collection since it's possible that you may get more than one entity returned.
Go ahead and deploy your EJB.
When you deploy your EJB, OC4J will generate a finder method for this method for you.
Now what you need to do is to modify the generated XML deployment descriptor to tune the query if you will.
OC4J generates the deployment descriptor info it needs for an application in $OC4J/application-deployments.
Go to to $OC4J/application-deployments/<app-name>/<ejb-name> where app-name and ejb-name are specific your deployed EJB.
Open the orion-ejb-jar.xml file. This is the file OC4J uses to describe the deployed beans.
Search through the file until you find the <finder-method> tag.
Amend the query attribute of the finder-method tag to reflect the where clause of the query you want to execute:
query="$name = $1 AND $price > $2"
Now go to the generated SQL string and add the corresponding SQL where condition, using a ? in place of the actual value of the query string above
It would become something like ...
< !-- Generated SQL: "select drinks.id, drinks.name, drinks.price from drinks where drinks.name = ? AND drinks.price > ?" -->
Note that in this query, the where clause matches the query you specified, but you omit the actual values.
Check the method-params defined for the find below and ensure that the order of them lines up with the values you've specified in the finder query.
Stop OC4J and restart it and the new finderMethod should come into effect.
Give that a try and see how you go.
cheers!
-steve-
null

Similar Messages

  • CMP Custom Finder Method Problem

    Hi everybody,
    I have a problem about CMP Custom Finder Method.
    I made CMP Entity Bean and deployed.
    Then, I updated finder section in orion-ejb-jar.xml to add my custom finder query.
    Here is updating finder section in my orion-ejb-jar.xml.
    <finder-method query="(($schStartDate &lt;= TO_DATE($1,'MM-DD-YYYY a HH:MI') and $schEndDate &gt;= TO_DATE($1,'MM-DD-YYYY a HH:MI')) or ($schStartDate &lt;= TO_DATE($2,'MM-DD-YYYY a HH:MI') and $schEndDate &gt;= TO_DATE($2,'MM-DD-YYYY a HH:MI'))) and ($schRoom = $3)">
    <!-- Generated SQL: "......" -->
    <method>
    <ejb-name>RoomSchedule</ejb-name>
    <method-name>findBySchDateAndRoom</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    <method-param>java.lang.String</method-param>
    <method-param>java.lang.String</method-param>
    </method-params>
    </method>
    </finder-method>
    <resource-ref-mapping name="jdbc/OracleDS" />
    And, i restarted oc4j. so, oc4j redepoyed CMP bean.
    But, when my client program called CMP Bean, lookup() was ok, but calling findBySchDateAndRoom() was bad.
    I couldn't get any result collection.
    Here is my client code.
    Context ctx = new InitialContext();
    Object ref = ctx.lookup("RoomSchedule");
    roomScheduleHome = (RoomScheduleHome) PortableRemoteObject.narrow(ref, RoomScheduleHome.class);
    String startDT = new String("07-30-2002 am 10:30");
    String endDT = new String("07-30-2002 pm 05:20);
    String roomID = "TEST";
    Collection roomAllSch = roomScheduleHome.findBySchDateAndRoom(startDT, endDT, roomID1);
    Iterator roomSchItr = roomAllSch.iterator();
    int schQty = 0;
    while (roomSchItr.hasNext()) {
    roomSchedule = (RoomSchedule) roomSchItr.next();
    if(roomSchedule.getStatus().equals("A"))
    schQty++;
    After excuting above code, schQty was still zero!!
    Because Collection roomAllSch had not any items.
    But, table ROOMSCHEDULE had 30 records which were same query condition in my database.
    I traced SQL statement using P6Spy Class.
    Here is spy.log.
    1028006337814|10|0|statement|select * from RoomSchedule where ((RoomSchedule.schStartDate <= TO_DATE(?,'MM-DD-YYYY A.M. HH:MI') and RoomSchedule.schEndDate >= TO_DATE(?,'MM-DD-YYYY A.M. HH:MI')) or (RoomSchedule.schStartDate <= TO_DATE(?,'MM-DD-YYYY A.M. HH:MI') and RoomSchedule.schEndDate >= TO_DATE(?,'MM-DD-YYYY A.M. HH:MI'))) and (RoomSchedule.schRoom = ?)|select * from RoomSchedule where ((RoomSchedule.schStartDate <= TO_DATE('7-30-2002 ?@@| 01:00','MM-DD-YYYY A.M. HH:MI') and RoomSchedule.schEndDate >= TO_DATE('7-30-2002 ?@@| 01:00','MM-DD-YYYY A.M. HH:MI')) or (RoomSchedule.schStartDate <= TO_DATE('7-30-2002 ?@HD 12:00','MM-DD-YYYY A.M. HH:MI') and RoomSchedule.schEndDate >= TO_DATE('7-30-2002 ?@HD 12:00','MM-DD-YYYY A.M. HH:MI'))) and (RoomSchedule.schRoom = 'Earth')
    1028006337824|10|0|statement|select RoomSchedule.schTitle, RoomSchedule.schStartDate, RoomSchedule.schEndDate, RoomSchedule.schDayAll, RoomSchedule.status, RoomSchedule.schRoom, RoomSchedule.reqUser, RoomSchedule.apprUser, RoomSchedule.purpose, RoomSchedule.relatoinID, RoomSchedule.schDesc, RoomSchedule.reqDate, RoomSchedule.apprDate from RoomSchedule where (RoomSchedule.schID = ?)|select RoomSchedule.schTitle, RoomSchedule.schStartDate, RoomSchedule.schEndDate, RoomSchedule.schDayAll, RoomSchedule.status, RoomSchedule.schRoom, RoomSchedule.reqUser, RoomSchedule.apprUser, RoomSchedule.purpose, RoomSchedule.relatoinID, RoomSchedule.schDesc, RoomSchedule.reqDate, RoomSchedule.apprDate from RoomSchedule where (RoomSchedule.schID = 0)
    As you see it, two query statement were executed.
    First query statement was ok and got some result records.
    But, second query statement was bad so didn't get any result records.
    I didn't understand why second query statement was executed.
    When roomAllSch.iterator() was being excuted in my client program, second query statment was executed.
    I couldn't believe....
    What's wrong? Please help me....
    OC4J : Version 9 Release 2
    Database : Oracle 8i
    OS : Windows 2000 Professional

    I created CMP of EJB 1.1, I wanted to add a finder
    there, but it didn't work.
    the error message is:
    "AccountEJB_vkbo0d_HomeImpl.java":
    AccountEJB_vkbo0d_HomeImpl should be declared
    abstract; it does not define findBySalary(float) in
    AccountEJB_vkbo0d_HomeImpl at line 11, column 1I think I don't remember CMPs having finder methods anything other than abstract. The code goes in the deployment descriptor. I hope you atleast got that right.
    Richard.

  • Does CMP bean finder method supports "LIKE" sql?

    I put something like this in the orion-ejb-jar.xml file:
    <finder-method partial="false" query="select * from EMP where $ename like $1 AND $job like $2">
    </finder-method>
    If I put in exact value like 'ADAMS' or 'CLERK', it works fine. But if I put in 'A%' or 'CL%', it does not work. I know the record is there and the same sql does return a row in sql-plus.
    Appreciate any help.
    Adam

    I put something like this in the orion-ejb-jar.xml file:
    <finder-method partial="false" query="select * from EMP where $ename like $1 AND $job like $2">
    </finder-method>
    If I put in exact value like 'ADAMS' or 'CLERK', it works fine. But if I put in 'A%' or 'CL%', it does not work. I know the record is there and the same sql does return a row in sql-plus.
    Appreciate any help.
    Adam gday Adam -
    I don't think there is anything in the persistence manager that will prevent this from working as you want.
    Can I ask what version of OC4J you are using?
    I'm not sure from your email if you are you specifying the fields in the finder method by surrounding them with SQL style quotes as in 'A%'? You shouldn't need to do that if you are.
    I just tested it out with a simple client and entity bean based on the employee table, which I created in about 30 seconds with the new JDeveloper CMP Entity Bean Wizard, using the create from existing table option.
    I added a finder method that looks like the following:
    Collection findByEnameAndJob(String ename, String job) throws RemoteException, FinderException;
    And then changed the SQL in the finder dialog (or orion-ejb-jar.xml) for the finder to be
    <finder-method partial="False" query="select * from emp where $ename like $1 and $job like $2">
    <method>
    <ejb-name>Emp</ejb-name>
    <method-name>findByEnameAndJob</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    <method-param>java.lang.String</method-param>
    </method-params>
    </method>
    </finder-method>
    The client code then looked for employees with a name starting with the letter A and whose job started with the letters CL as follows:
    Collection coll = empHome.findByEnameAndJob("A%","CL%");
    System.out.println("*** There were : " + coll.size() + " records returned ***");
    Iterator iter = coll.iterator();
    while (iter.hasNext())
    emp = (Emp)iter.next();
    System.out.println("empno = " + emp.getEmpno());
    System.out.println("ename = " + emp.getEname());
    When the client was run, this was the resulting output:
    *** There were : 1 records returned ***
    empno = 7876
    ename = ADAMS
    job = CLERK
    mgr = 7788
    hiredate = 1987-05-23 00:00:00.0
    sal = 1100
    comm = 0
    deptno = 20
    If you want to find all the entries that have a job that starts with CL you can even use the same finder method like:
    Collection coll = empHome.findByEnameAndJob("%","CL%");
    This results in the output
    *** There were : 4 records returned ***
    empno = 7369
    ename = SMITH
    job = CLERK
    mgr = 7902
    hiredate = 1980-12-17 00:00:00.0
    sal = 800
    comm = 0
    deptno = 20
    empno = 7876
    ename = ADAMS
    job = CLERK
    mgr = 7788
    hiredate = 1987-05-23 00:00:00.0
    sal = 1100
    comm = 0
    deptno = 20
    empno = 7900
    ename = JAMES
    job = CLERK
    mgr = 7698
    hiredate = 1981-12-03 00:00:00.0
    sal = 950
    comm = 0
    deptno = 30
    empno = 7934
    ename = MILLER
    job = CLERK
    mgr = 7782
    hiredate = 1982-01-23 00:00:00.0
    sal = 1300
    comm = 0
    deptno = 10
    I can send you the packaged EAR file if you want to try this simple example for yourself - or you I would even encourage you to grab JDeveloper 9i and see how it easy it makes it to build and test the example I was just working with.
    cheers!
    -steve

  • EJB CMP finder methods

    The Oracle documents suggests that the following definition in the EJBHome is enough to create a finder method
    public Enumeration findByWhere(String where) throws RemoteException, FinderException;
    I get a java.lang.AbstractMethodError on the client when I try to call this - suggesting the the container is not implementing the method for me.
    I see no place in the oracle descriptor to define these finder methods.
    What is the deal with these ? How does one use CMP and Finder methods other than the standard "findByPrimaryKey(....)
    thanks
    null

    Hello,
    Let say you don't want to uyse the defualt finder methods, then you can write your own like:
    (in client servlet/JSP file etc..)
    emps = home.findByLast_name(request.getParameter("searchText")); //find by last name
    where:
    step 1) go to EJB class editor (under your main EJB directory)
    step 2) click on finder tab and click add, to add new finder methods
    step 3) (you can click help now to get more info on this..anyways) findBy<CMB field>
    would automatically check the "Managed by OC4j" check box, this means that you have matched a signature tag for finders (kind of like setXX and getXX if you are doing JavaBean...automatically done for you)
    step 4) else you can make one that is not up like findWildCard(String wildCard):
    i)by specifying the Method name to be: findWildCard
    ii)parameter (String type: wildCard)
    step 5) rebuild the EJB directory after you add this method
    step 6) use it in any of you client servlet/JSP as you would with the defualt findAll() methods etc..
    cheers,
    -Long
    [email protected]

  • Custom finder methods

    I'm tring to deploy an Entity bean (CMP) with custom finder method that gets a parameter.
    I encountered two problems :
    1) defining the query in the deployment descriptor coased the app server to generate the a query without the where cloase - this was fixed by changing manualy the orion-ejb-jar.xml in the application-deployments directory.
    2)the second, and yet unresolved problem, is that OC4J doesn't bind the parameter that the query uses during runtime. I'm recieving an ORA msg that claims that not all the parameters are binded.

    see sample code
    http://otn.oracle.com/sample_code/tech/java/oc4j/htdocs/oc4jsamplecode/oc4j-demo-ejb.html
    also there should be a section in our documentation about cmp custom finder methods. oc4j attempts to generate custome finder methods based on home interface
    <finder-method query="$empNo = $1">
    <method>
                             <ejb-name>EmployeeBean</ejb-name>
                             <method-name>findByEmpNo</method-name>
                             <method-params>
                                  <method-param>java.lang.Integer</method-param>
                             </method-params>
                        </method>
                   </finder-method>

  • Finder  method in Entity bean

    how many Finder method in Entity bean i can write ?
    look below...
    public Account findByPrimaryKey(AccountPK key) throws FinderException,
    RemoteException;
    public Enumeration findByOwnerName(String name) throws FinderException,
    RemoteException;here 2 finder methods are there.......i am asking how much freedom i have ? can write as many as finder method i wish ?
    say, findXXXX() ?

    my problem is on the signature of the find
    method.
    OK let me ask you some other way.
    java DOC says
    Each enterprise Bean has a home interface. The home
    interface must extend the javax.ejb.EJBHome
    interface, and define the enterprise Bean type
    specific create and finder methods (session Beans do
    not have finders).
    look it says " finder methods "....right .
    so i want to ask 2 question about this phrase . PLZ
    do confirm me whether i am right or wrong.
    fact 1. finder methods means you can write
    any method name which starts with word find
    and ONLY find
    Example: findABCD( ) , findEFGH(),
    findBLAHBLAH()...any thing starts with find[i]
    are called finder methods...others are NOT.
    is This fact correct ?
    Yes.
    fact 2. Is not it Strange that i need to
    append some letters after the word find to
    get a finder method name !! why not wrting a simple
    method name ( say abcdfgrty () instead of
    findXXXX() which will do the job ??You can... but it has to be called form a findXXXX() method :)
    As such there is no problem in writng a
    find_ANY_WORDS_HERE() to get a finder method but
    problem is why i need to stick to the word
    find and append some words after it
    t to get a finder method ? if i had to do it
    seriously then whats the role of the container ? how
    w it is linking ?Once someone takes the pain of going through the EJB specs, he would not have a problem. Imagine each vendor using his own brains and the developer getting bugged with new features in each AS. EJB specs are flexible enough already :)

  • CMP Entity Bean with ejb-ql finder methods and INFORMIX database

    Hi,
    I have some CMP Entity Beans with finder methods defined in ejb-ql. In my ejb-jar, within <entity> definitions I have something like:
        <entity>
          <abstract-schema-name>BeanName</abstract-schema-name>
          <cmp-field><field-name>fieldOne</field-name></cmp-field>
          <cmp-field><field-name>fieldTwo</field-name></cmp-field>
          <query>
            <query-method>
              <method-name>findAll</method-name>
              <method-params></method-params>
            </query-method>
            <ejb-ql>SELECT OBJECT(o) FROM BeanName o</ejb-ql>
          </query>
        <entity>
    And in persistent.xml:
    <db-properties>
         <data-source-name>datasource_name</data-source-name>
    </db-properties>
    <entity-bean>
         <ejb-name>BeanName</ejb-name>
         <table-name>table_name</table-name>
         <field-map key-type="NoKey">
         <field-name>fieldOne</field-name>
         <column><column-name>column_one</column-name></column>
          </field-map>
         <field-map key-type="NoKey">
         <field-name>fieldTwo</field-name>
         <column><column-name>column_two</column-name></column>
          </field-map>
          <finder-descriptor>
              <method-name>findAll</method-name>
              <method-params/>
         </finder-descriptor>
    Once deployed, on server side, I can found a java source file (with corresponding compiled class file) in path:
    j2ee/cluster/server0/apps/companyName/MyEARApp/EJBContainer/temp/temp38837373733/route/to/package/
    with names:
    BeanName0_0pm.java
    BeanName0_0PM.class
    and the generated java file contains this code:
      public java.util.Enumeration ejbFindAll() throws javax.ejb.FinderException, javax.ejb.EJBException  {
        TransactionContext tc = pm.getTransactionContext();
        Connection conn = null;
        PreparedStatement pSt = null;
        ResultSet ejb_rs = null;
        int status = javax.transaction.xa.XAResource.TMSUCCESS;
        try {
          conn = pm.getConnectionForFindMethod();
          pSt = conn.prepareStatement("SELECT \"O\".\"COLUMN_ONE\",\"O\".\"COLUMN_TWO\", FROM \"TABLE_NAME\" \"O\"");
          ejb_rs = pSt.executeQuery();
    I'm trying to call this method but it throws a SQLException when preparing the statement.
    It seems that Informix does not like this SQL syntax because of upper case names, doble quotes on table alias, or something else.
    When editing persistent.xml in netweaver, I can define the element <datasource-vendor> as ORACLE, SAPDB, MS_SQL_SERVER, DB2_UDB_AS400 or DB2_UDB_OS390 but INFORMIX is not an accepted value.
    Is there any way to define how this SQL query is build?
    Thanks in advance.

    The return type of the finder method defined in the remote home interface is either the entity bean's remote interface or a collection of objects implementing the entity bean's remote interface. The return type of the finder method defined in the local home interface is either the entity bean's local interface or a collection of objects implementing the entity bean's local interface

  • 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

  • CMP beans, VCafe IDE and " finder-expression "

    I am building CMP beans, and am trying to make some finder methods.
    VCafe allows you to make the string for the "<finder-query>" element in
    the weblogic-cmp-rdbms-jar.xml, but I can't find UI to also add a
    "<finder-expression>" element to the finder-query. Am I just missing it
    somewhere, or why the omission?

    Using this will allow me to make the <finder-query> attrubute, but NOT any
    <finder-expression> attributes.....Or am I missing something? I am trying to
    have my finder pass in a PK object, but then use the public primative members
    of the PK object to compare to what is in the database. If I say
    findbyForeignKey(ForeignPK) and the database has a foreign_id column that
    contains a long, and the ForeignPK has a long as it's id, I can't use (= $0
    foreign_id). I get an error. The EJB Deployer tool allows you to add
    expressions like <number> 0, <expression> @0.id, <type> long, all along with
    the finder query. Does anyone know how to add the expression part of the
    query, not just the WLQL query itself, in VCafe?
    Nirav Chanchani wrote:
    Michael,
    I assume you are using WebGain Studio 4.0. The sequence is
    Project->Configure Deployment Descriptor->Target Options Tab->Finders Tab.
    Nirav.
    Michael SMith wrote:
    I am building CMP beans, and am trying to make some finder methods.
    VCafe allows you to make the string for the "<finder-query>" element in
    the weblogic-cmp-rdbms-jar.xml, but I can't find UI to also add a
    "<finder-expression>" element to the finder-query. Am I just missing it
    somewhere, or why the omission?--
    Nirav Chanchani
    BEA Systems, Inc.

  • 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

  • CMP finder method error

    I'm now using Jbuilder7+weblogic7 to do some EJB develop.
    Weblogic server is configured to run inside the Jbuilder IDE, and my CMP entity bean has been deployed successfully.
    I new a "EJB test client" within Jbuilder to test my CMP bean, I could create entity bean via create method, but when I using finder method to find a bean, the client report that "java.sql.SQLException: No data found"!
    My EJB-QL is:"SELECT OBJECT(o) FROM Account o WHERE o.ownername = ?1"
    And below is the exception report:
    javax.ejb.FinderException: Problem in findByOwnername while preparing or executing statement: 'weblogic.jdbc.rmi.SerialPreparedStatement@1d2384':
    java.sql.SQLException: No data found
    java.sql.SQLException: No data found
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6212)
         at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3266)
         at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5398)
         at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:326)
         at weblogic.jdbc.jts.ResultSet.getString(ResultSet.java:84)
         at weblogic.jdbc.rmi.internal.ResultSetImpl.getString(ResultSetImpl.java:178)
         at weblogic.jdbc.rmi.internal.ResultSetStraightReader.getString(ResultSetStraightReader.java:37)
         at weblogic.jdbc.rmi.SerialResultSet.getString(SerialResultSet.java:128)
         at cmptest.AccountBean_8259n1__WebLogic_CMP_RDBMS.__WL_loadGroup0FromRS(AccountBean_8259n1__WebLogic_CMP_RDBMS.java:945
    Can anybody help me out? Thanks.

    The Exception is pretty clear there are no Records found for the Owner Name u give. Try Creating the Suitable record from ur Entity Bean(create method of course) then check in the DB for the Record and then try to retrieve it....I don't think there should be any problem....
    Cheers,
    manja

  • CMP Finder Method

    Could you supply a couple of examples of setting up a custom CMP Finder Method using both SQLJ and JDBC?
    In particular how is the SQL coded in the "SQL Query" textbox on the "Method" tab? How are the parameters and the result set referenced and returned? What is the return type?
    Simple Select / Where clause multirow and single row examples should suffice.
    I using JDeveloper 9.0.2.8.2.
    Thanks.

    You can create custom CMP Finder Methods which takes appropriate sql but not SQLJ and JDBC.
    i.e if you are adding a custom finder method in orion-ejb-jar.xml it takes only SQL not java code
    In JDeveloper select orion-ejb-jar.xml in the project and right-click on it and choose Settings option
    Select the Entity bean in the navigator and choose Finder methods
    Click on Add. The dialog box will allow to add a new finder method with SQL query
    Click on Help for specific information
    Couple of hints are
    Partial
    Whether or not the specified query is a partial one. A partial query is the 'where' clause or the 'order' (if it starts with order) clause of the SQL query.
    Queries are partial by default. If partial="false" is specified then the full query is to be entered as value for the query attribute and you need to make sure that the query produces a result-set containing all of the CMP fields. This is useful when doing advances queries involving table joins and similar.
    Query
    The query part of an SQL statement. This is the section following the WHERE keyword in the statement. Special tokens are $number which denotes an method argument number and $name which denotes a cmp-field name. For instance the query for "findByAge(int age)" would be (assuming the cmp-field is named 'age'): "$1 = $age".
    Return type can be collection if the query is returning more than one row of data or it could be the entity bean type itself (if it is only one row)
    raghu
    JDev Team

  • Why does a find and replace method remove whitespace?

    I have method that searches for a string in a FM document and replaces it with a variable. If for example, there was a string foobar that I wanted to replace with the variable barfoo. Then, I expect this text:
    Lorem ipsum dolor sit amet, foobar consectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    To be changed to this text:
    Lorem ipsum dolor sit amet, barfoo consectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    However, while the text does do the replace it also removes the whitespace between the variable and the text that appears right after the variable so it actually looks looks like this:
    Lorem ipsum dolor sit amet, barfooconsectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    Why is the find and replace method removing the whitespace and how do I prevent that from happening? The method is provided below.
    function FindAndReplaceString(pDoc, findString, replaceVariable)
        if (typeof pDoc != 'undefined'&&typeof findString != 'undefined'&&typeof replaceVariable != 'undefined'&&pDoc.ObjectValid()&&findString.length>0&&replaceVariable.length>0)
            var vVarFmtStatus=checkVarFmStatus (pDoc, replaceVariable);
            if (vVarFmtStatus=='In Doc')
                var tr = new TextRange();
                var findParams = new PropVals();
                var frame = pDoc.MainFlowInDoc.FirstTextFrameInFlow;
                var restoreTR = pDoc.TextSelection;
                tr.beg.obj = tr.end.obj = frame.FirstPgf;
                tr.beg.offset = tr.end.offset = 0;
                findParams = AllocatePropVals(1);
                findParams[0].propIdent.num = Constants.FS_FindText;
                findParams[0].propVal.valType = Constants.FT_String;
                findParams[0].propVal.sval = findString;
                tr = pDoc.Find(tr.beg, findParams);
                var vLoopCounter=0;
                while(FA_errno === Constants.FE_Success&&vLoopCounter++< 1000)
                    pDoc.TextSelection = tr;
                    pDoc.Clear(0);
                    var newVar = pDoc.NewAnchoredFormattedVar(replaceVariable, tr.beg);
                    var varLength = newVar.TextRange.end.offset - newVar.TextRange.beg.offset;
                    tr.beg.offset += varLength;
                    tr = pDoc.Find(tr.beg, findParams);
                if (vLoopCounter>0)
                    Log (vLogFileName, 'In the document \''+pDoc.Name+'\', the string \''+findString+'\' was replaced with the variable \''+replaceVariable+'\' '+vLoopCounter+' times.\n')
                if (vLoopCounter>1000)
                    recordErrors (vErrorLog, 'ERROR: In the document "'+pDoc.Name+'", the find and replace operation was stopped after executing '+vLoopCounter+' times. The term being searched for is "'+findString+'" the replacement variable is "'+ replaceVariable+'".')
                pDoc.TextSelection = restoreTR;
                pDoc.ScrollToText(restoreTR);
                } else {
                    recordErrors (vErrorLog, 'ERROR: The find and replace operation failed because the variable '+replaceVariable+' does not exist in the following doc: '+pDoc.Name)
            } else {
                recordErrors (vErrorLog,'Invalid or unitialized parameter passed to function FindAndReplaceString')

    Hi,
    Not at the moment. Please post in http://forums.adobe.com/community/muse/ideas so other users can vote on the feature request.
    Thanks,
    Abhishek

  • Oracle forms - .find method and .select method both recognized as .find method in OATS

    Hi All,
    Am working on Oracle EBS version R12.1.3 and trying to SELECT a responsibility from List of Values (LOV) but the code is working as .find method.
    Code:
    forms.listOfValues("//forms:listOfValues").select("001_Responsibility");
    The above method is working as
    forms.listOfValues("//forms:listOfValues").find("001_Responsibility");
    Please let me know if any details are required to understand issue.
    FYI:
    OATS version 12.4.0.1.139
    EBS version R12.1.3
    Thanks and Regards,
    Vasanth Kumar S M

    I called a procedure in in-insert and on-updateWhy are you writing this code in the first place? If you have a block based on an updatable view, just let Forms do the inserts and updates.
    If it's not an updatable view, use instead of triggers on the view.
    See this current thread too:
    INSTEAD of Trigger View for an Oracle EBS New form development

Maybe you are looking for

  • Adobe Acrobat/Reader can not be used to view PDF's in Web browser.

    Does any one came accross the following message trying to view PDF's in web browser? "Adobe Acrobat/Reader that is running can not be used to view PDF documents in Web browser. Please exit the Acrobat?Reader application and try again". Thanks for you

  • Error while loading application

    Hi, I'm not sure this is the right forum, but I try anyway. I'm trying to use a 3rd party Java application Unico (just use it, I don't develop anything of that) that after working for weeks, suddenly refuses to load at startup, and returns an error l

  • Help Moving iWeb site to a windows PC

    My objective is to create a site using iWeb and move that site to a standalone PC and use Firefox to read the site folder and run the site. Not needing any internet. The files are too large anyway. I have created the iWeb site with many videos from i

  • How to zip a folder containing subfolders with files and download the zip file in silverlght 4

    private void hbtnDownloadReceipt_Click(object sender, RoutedEventArgs e)            try                 string Docpath = "ClaimsDetails/" + "20tech" + "/" + PaymentAdviceUNo;                 string dd = "ClaimsDetails/";                 Uri uri = new

  • I book G4 1.42 1 Gig runs very slow on leopard

    I just installed leopard on my I book G4. It now runs like death, dare I say like a bad PC. Even typing is often delayed. Many simple programs will not run at a decent speed or will slow down within ten minutes to an unacceptable speed. I also notice