Discussions

EJB design: When 2 use ejbSelect() method?

  1. When 2 use ejbSelect() method? (2 messages)

    I am new to this form. Please explain when 2 use ejbSelect method in a bean?

    Thank you.
  2. When 2 use ejbSelect() method?[ Go to top ]

    ejbSelect provides a more flexible method to query the database than find methods. Find methods belong to a home interface and only return
    the corresponding local object. A findStudent method in StudentHome can only return a Student or a collection of Students.
    ejbSelect methods can return any type in the database or a collection of database objects. They are restricted to the entity bean implementation class; you'll need to write a separate business method to expose the results of the query.

    Like find methods, ejbSelect methods use the deployment descriptor to define the EJB-QL query. Resin-CMP will generate the appropriate SQL for the select.

    Example Query -

    SELECT student.age
    FROM select_house house, IN(house.studentList) student
    WHERE student.gender='Boy' AND house= ?1
    ORDER BY student.name

    -arun
  3. Hi,
    ejbSelect() method is use to return local object ,collection and data types. If u want to use the records within the entity bean means u can use ejbselect(). Suppose if u want to pass the resultant value to client side means u have to use ejbFind()