|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Home interface for the Course bean. The home interface for the Course bean. The home interface enables you to create new entities and to obtain references to existing ones using find methods.
The home interface enables you to create new entities and to obtain references to existing ones.
The idea is that you use the Home Interface to obtain references to whatever entities you're interested in. Each entity that you
Applications use the Home Interface to obtain references to whatever entities it needs. Each entity that you get from the Home Interface (using its create or finder methods) is then accessible through its Local Interface.
Method Summary | |
java.util.Collection |
findAll()
Returns a Collection of all Course entities in the database. |
Course |
findByInstructor(java.lang.String instructorName)
Returns the Course taught by the indicated instructor. |
Course |
findByPrimaryKey(java.lang.String courseId)
Returns the Course that has courseId
as its primary key. |
Methods inherited from interface javax.ejb.EJBLocalHome |
remove |
Method Detail |
public Course findByInstructor(java.lang.String instructorName) throws javax.ejb.FinderException
Course
taught by the indicated instructor.
This is an example of a finder method that returns a single
entity. If no courses match or if multiple classes match, the find
method will throw an exception.
The return type is the local interface of the bean. Find methods always return a single instance of the local interface or a collection of the local interfaces. Applications which need to return other entity bean interfaces or values must use ejbSelect methods in the bean implementation.
The find method's query is specified in the deployment descriptor
in the <query> tag using EJB-QL. "?1" refers to the first
method argument. find_courses is the abstract-schema-name in the
deployment descriptor. This may differ from the actual SQL table
if sql-table-name has been specified.
SELECT o FROM find_courses o WHERE o.instructor = ?1
Resin-CMP will generate the code and SQL for the find method.
instructorName
- name of the instructor who teaches
the Course
we want to find.ObjectNotFoundException
- if there is no matching course.javax.ejb.FinderException
- if there are more than one matching courses.public java.util.Collection findAll() throws javax.ejb.FinderException
Course
entities in the database.
This is an example of a finder method that returns a Collection of
entities.
Resin-CMP will implement this method. All we have to provide is this
declaration, and a <query>
section in the deployment
descriptor.
SELECT o FROM find_courses o
public Course findByPrimaryKey(java.lang.String courseId) throws javax.ejb.FinderException
Course
that has courseId
as its primary key.
Every entity EJB needs to define this finder method that looks for an entity based on the primary key.
courseId
- the primary key of the courseObjectNotFoundException
- if there is no course matching the key.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |