example.cmp.ejbql
Interface CourseHome

All Superinterfaces:
javax.ejb.EJBLocalHome

public interface CourseHome
extends javax.ejb.EJBLocalHome

Home interface for the Course bean. The Home Interface enables you to create new entities and to obtain references to existing ones.

The CourseHome example provides two finder methods: the standard findByPrimaryKey and a findByHouse method. Find methods for a local home always return the local interface or a collection of the local interface.

All find methods except findByPrimaryKey need an EJB-QL query in the deployement descriptor.


Method Summary
 java.util.Collection findByHouse(java.lang.String house)
          Finds all the courses for the students living in a house.
 Course findByPrimaryKey(java.lang.String primaryKey)
          This is an example of a finder method that returns a single entity if successful, and throws an ObjectNotFoundException if it was unsuccessful.
 
Methods inherited from interface javax.ejb.EJBLocalHome
remove
 

Method Detail

findByPrimaryKey

public Course findByPrimaryKey(java.lang.String primaryKey)
                        throws javax.ejb.FinderException
This is an example of a finder method that returns a single entity if successful, and throws an ObjectNotFoundException if it was unsuccessful. Every entity EJB needs to define this finder method that looks for an entity based on the primary key.

findByHouse

public java.util.Collection findByHouse(java.lang.String house)
                                 throws javax.ejb.FinderException
Finds all the courses for the students living in a house. The example methods shows how a query can use the IN(...) expression to select a collection of entities.
 SELECT DISTINCT OBJECT(course)
 FROM ejbql_student student, IN(student.courseList) course
 WHERE student.house.name=?1
 
Parameters:
house - the name of the student's house.
Returns:
the matching collection of courses.