findAll method in weblogic5.1 wlql


EJB programming & troubleshooting: findAll method in weblogic5.1 wlql

  1. findAll method in weblogic5.1 wlql (2 messages)

    I have tried to declare a findAll method with weblogic 5.1 and I can't
    get it right (CMP).

    In the online-documentation I have found the following:

         The following example finds all the EJBs in a table. It uses the
    sample finder method signature:

            public Enumeration findAllAccounts()

                  throws FinderException, RemoteException

           The sample <finder> stanza uses an empty WLQL string:





    but if I do such a method I get following exception:

    javax.ejb.FinderException: Exception preparing or executing statement:
    'select id, balance from tblAccount where'
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL
    Server]Line 1: In
    correct syntax near 'antalRum'.
            at sun.jdbc.odbc.JdbcOdbc.createSQLException(

            at sun.jdbc.odbc.JdbcOdbc.standardError(
            at sun.jdbc.odbc.JdbcOdbc.SQLPrepare(

    It looks like weblogic generates a SQL-statement 'select id, balance
    from tblAccount where' instead of 'select id, balance from

    Can somebody explain this


    Shakti Mishra

  2. You may be required to put a where clause inside your finder-query tag. I know this option is not very elegant, but if you never use zero for the id you could do something like this:

    <finder-query>![CDATA[(= $0 id)]]</finder-query>

    When you call the findby, pass in a 0 value.

    Word of caution, generally you don't want to retrieve all the records in a distributed system unless it is a very small set of data. If it is a large amount of data, you will bring your system to its knees.

    Atleast this should work,

  3. The same problem i was getting when i was trying to search all records. U might be using database as sqlServer. What i did was u just check your primarky key field with not null and u will get the solution what u want. Because ur primary key always have some value of u will all the data.