StudentEJB.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:2k
源码类别:
Java编程
开发平台:
Java
- package day21ex.student;
- import java.sql.*;
- import javax.sql.DataSource;
- import javax.naming.*;
- import javax.ejb.*;
- import java.util.*;
- public abstract class StudentEJB implements EntityBean {
- protected EntityContext ctx;
- public abstract String getStudentId();
- public abstract void setStudentId(String studentId);
- public abstract String getFirstName();
- public abstract void setFirstName(String firstName);
- public abstract String getLastName();
- public abstract void setLastName(String lastName);
- public abstract String getAddress();
- public abstract void setAddress(String address);
- public abstract String getEmailAddress();
- public abstract void setEmailAddress(String emailAddress);
- public void setEntityContext(EntityContext ctx) {
- System.out.println("Student.setEntityContext called");
- this.ctx = ctx;
- }
- public void unsetEntityContext() {
- System.out.println("Student.unsetEntityContext called");
- this.ctx = null;
- }
- public void ejbActivate() {
- System.out.println("Student.ejbActivate() called.");
- }
- public void ejbPassivate() {
- System.out.println("Student.ejbPassivate () called.");
- }
- public void ejbStore() {
- System.out.println("Student.ejbStore() called.");
- }
- public void ejbLoad() {
- System.out.println("Student.ejbLoad() called.");
- }
- public String ejbCreate(String id, String firstName, String lastName,
- String address, String emailAddress)
- throws CreateException {
- System.out.println("Student.ejbCreate() called.");
- setStudentId(id);
- setFirstName(firstName);
- setLastName(lastName);
- setAddress(address);
- setEmailAddress(emailAddress);
- return null;
- }
- public void ejbPostCreate(String id, String firstName, String lastName,
- String address, String emailAddress)
- throws CreateException {
- System.out.println("Student.ejbPostCreate() called.");
- }
- public void ejbRemove() throws RemoveException {
- System.out.println("Student.ejbRemove() called.");
- }
- }