|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Local interface for a course taught at Hogwarts, providing
methods to view and change it.
CREATE TABLE basic_courses (
course_id VARCHAR(250) NOT NULL,
teacher VARCHAR(250),
PRIMARY KEY(course_id)
);
All Course instances are obtained from the CourseHome interface, and all access to the Course table occurs through the Course interface. Clients can never use the CourseBean implementation directly or directly access the database for the course table. Because Resin-CMP has complete control over the database's course entries, it can more effectively cache results, often avoiding slow database access.
CourseId is the bean's primary key. Every entity bean must have
a primary key.
There is a setInstructor
mutator, but no
setCourseId
mutator because clients can't set the primary key.
Resin-CMP needs to implement the
setCourseId
method that has been defined in the implementation
class,CourseBean.java
. But the Implementation Class is
not associated with any particular entities -- it is only used by the
container to implement the Local Interface. If you want to use a method from
the implementation class when calling from a client, it has to be made
available explicitly in the Local Interface.
Method Summary | |
java.lang.String |
getCourseId()
Returns the ID of the course (CMP field). |
java.lang.String |
getInstructor()
Returns the instructor's name (CMP field). |
void |
setInstructor(java.lang.String instructor)
Sets the instructor's name (CMP field). |
void |
swap(Course course)
Swaps the instructor for a course. |
Methods inherited from interface javax.ejb.EJBLocalObject |
getEJBLocalHome, getPrimaryKey, isIdentical, remove |
Method Detail |
public java.lang.String getCourseId()
public java.lang.String getInstructor()
public void setInstructor(java.lang.String instructor)
instructor
- the name of the new instructor.public void swap(Course course)
course
- the course which will swap instructors.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |