📄 stubean.java
字号:
package dfbz.stu.ejb;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
/**
* XDoclet-based session bean. The class must be declared
* public according to the EJB specification.
*
* To generate the EJB related files to this EJB:
* - Add Standard EJB module to XDoclet project properties
* - Customize XDoclet configuration for your appserver
* - Run XDoclet
*
* Below are the xdoclet-related tags needed for this EJB.
*
* @ejb.bean name="Stu"
* display-name="Name for Stu"
* description="Description for Stu"
* jndi-name="ejb/Stu"
* local-jndi-name="ejb/StuLocal"
* type="Stateful"
* view-type="both"
*/
public class StuBean implements SessionBean {
/** The session context */
private SessionContext context;
public void ejbCreate() {
}
public StuBean() {
// TODO Auto-generated constructor stub
}
// 锐化
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
// 打开资源
}
// 钝化
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
// 关闭资源
}
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/**
* Set the associated session context. The container calls this method
* after the instance creation.
*
* The enterprise bean instance should store the reference to the context
* object in an instance variable.
*
* This method is called with no transaction context.
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public void setSessionContext(SessionContext newContext)
throws EJBException {
context = newContext;
}
private String name;
private int age;
private String sex;
/**
* @ejb.interface-method view-type="both"
*/
public int getAge() {
return age;
}
/**
* @ejb.interface-method view-type="both"
*/
public void setAge(int age) {
this.age = age;
}
/**
* @ejb.interface-method view-type="both"
*/
public String getName() {
return name;
}
/**
* @ejb.interface-method view-type="both"
*/
public void setName(String name) {
this.name = name;
}
/**
* @ejb.interface-method view-type="both"
*/
public String getSex() {
return sex;
}
/**
* @ejb.interface-method view-type="both"
*/
public void setSex(String sex) {
this.sex = sex;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -