example.cmp.find
Class CourseBean

example.cmp.find.CourseBean

public abstract class CourseBean

Implementation class for the Course bean.

Its methods will be called only by the EJB container, and not ever by any client programs that we write. Instead, we call methods in the Remote Interface which will prompt the container to access methods in this class on our behalf. The container will also call the various housekeeping methods described below when it sees fit.

This CMP bean uses the following schema:

   DROP TABLE find_courses;
   CREATE TABLE find_courses (
     course_id VARCHAR(250) NOT NULL,
     instructor VARCHAR(250),

     PRIMARY KEY(course_id)
   );

   INSERT INTO find_courses VALUES('Potions', 'Severus Snape');
   INSERT INTO find_courses VALUES('Transfiguration', 'Minerva McGonagall');
   INSERT INTO find_courses VALUES('Defense Against the Dark Arts', 'Remus Lupin');
 
The implementation class for the Course bean. Its methods will be called only by the EJB container, and not by the client programs. The client calls methods in the local interface (Course) which will use the Resin-CMP-generated stub to access methods in this class on our behalf.


Constructor Summary
CourseBean()
           
 
Method Summary
abstract  java.lang.String getCourseId()
          Returns the id (and name) of this course (CMP field).
abstract  java.lang.String getInstructor()
          returns the name of the instructor who is teaching this course (CMP field).
abstract  void setCourseId(java.lang.String courseId)
          Sets the id (and name) of this course (CMP field).
abstract  void setInstructor(java.lang.String instructor)
          Sets the name of the instructor who is teaching this course (CMP field).
 

Constructor Detail

CourseBean

public CourseBean()
Method Detail

getCourseId

public abstract java.lang.String getCourseId()
Returns the id (and name) of this course (CMP field).

Each cmp-field described in the deployment descriptor needs to be matched in the implementation class by abstract setXXX and getXXX methods. The container will take care of implementing them.

Unless you make these methods available in the Local Interface, you will never be able to access them from an EJB client such as a servlet.

Resin-CMP will implement the getCourseId method.

Returns:
the course id

setCourseId

public abstract void setCourseId(java.lang.String courseId)
Sets the id (and name) of this course (CMP field). Because the course id is the bean's primary key, clients may not call it. setCourseId may only be called in the ejbCreate method.

Resin-CMP will implement the setCourseId methods.

Parameters:
courseId - the new course id
Throws:
javax.ejb.EJBException - if the database call or the transaction fails.

getInstructor

public abstract java.lang.String getInstructor()
returns the name of the instructor who is teaching this course (CMP field).

Resin-CMP will implement the getCourseId method.

Returns:
the name of the course's instructor.
Throws:
javax.ejb.EJBException - if the database call or the transaction fails.

setInstructor

public abstract void setInstructor(java.lang.String instructor)
Sets the name of the instructor who is teaching this course (CMP field).

Resin-CMP will implement the getCourseId method.

Parameters:
instructor - the name of the new course instructor.
Throws:
javax.ejb.EJBException - if the database call or the transaction fails.