Discussions

EJB programming & troubleshooting: How to get all records from table in case of CMP?

  1. How to get all records from table in case of CMP? (4 messages)

    Hi,
          How to get all records from table without having any WHERE condition in CMP.
      I know, jBoss is providing a method called FindAll(). This method returns the Collection Object which contains all the records from table.

    SQL stmt :
    select * from tablename;
          I think, this method is vendor specific. Is there any mechanism or method thru which I can all records from table in case of CMP which is not vendor specific. Otherwise, how we can get by using weblogic server.


    Thanks in advance,
    Devi
  2. Add a findAll() function to your home interface, then set the where clause to "TRUE", so that the resulting SQL is

    SELECT * FROM tablename WHERE TRUE;
  3. Where to set where clause to TRUE.

    Can U give syntactical steps

    Thanks
    Devi
  4. or you can put an expression that returns true always ..

    ( something like "SELECT * FROM TABLENAME WHERE 1 = 1" )
  5. Hi,
       I understood what you want to say.
    At CMP, if I use findAll() method in home interface, I hope I donot need to define any implementation at ejb bean.

    In xml file, Is there any thing corresponding to this method, should define. If we have to define the query, then what is the syntax in xml file for this method. Since, there is no parameters for this method.

    One more, In case of JBoss server, I donot need to define the method information even in xml file especially for findAll() method. If I call remotely this method, container will return all records(objects) as Collection Object.
    Is this method representation is vendor specific ?

    Is this same even for weblogic ?If not, how to define in xml file.

    Thanks,
    Devi