📄 recordingbean.java
字号:
package ejb.recording;
import java.rmi.RemoteException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
/**
* This class is our bean implementation where the business methods
* are implemented. Note that the RecordingBean does not implement
* the Recording interface.
*/
public class RecordingBean implements EntityBean {
/**
* Member variables
*/
public Integer recordingId;
public String recordingTitle;
public String recordingArtist;
public String catalogNumber;
public Double listPrice;
/**
* These are our business methods that do our work.
* These should be exposed by our remote interface.
*/
/**
* Accessors
*/
public Integer getRecordingId() {
return recordingId;
}
public String getRecordingTitle() {
return recordingTitle;
}
public String getRecordingArtist() {
return recordingArtist;
}
public String getCatalogNumber() {
return catalogNumber;
}
public Double getListPrice() {
return listPrice;
}
/**
* Mutators
*/
public void setRecordingId(Integer inId) {
recordingId = inId;
}
public void setRecordingTitle(String inTitle) {
recordingTitle = inTitle;
}
public void setRecordingArtist(String inArtist) {
recordingArtist = inArtist;
}
public void setCatalogNumber(String inNumber) {
catalogNumber = inNumber;
}
public void setListPrice(Double inPrice) {
listPrice = inPrice;
}
/**
* Create an instance of a Recording.
* In BMP this method would return the key.
* The EJB container manages creation.
* Notice the parameters match those for create() in the Home interface
*/
public Integer ejbCreate(Integer newId, String newCatalogNumber,
Double newListPrice, String newRecordingArtist,
String newRecordingTitle) {
recordingId = newId;
catalogNumber = newCatalogNumber;
listPrice = newListPrice;
recordingArtist = newRecordingArtist;
recordingTitle = newRecordingTitle;
return null;
}
/**
* Each ejbCreate must have a matching ejbPostCreate.
*/
public void ejbPostCreate(Integer newId, String newCatalogNumber,
Double newListPrice, String newRecordingArtist,
String newRecordingTitle) {}
/**
* These are the EJB methods, which we must define as
* an entity bean.
* Empty implementations for our simple CMP example
*/
public void ejbActivate() {}
public void ejbLoad() {}
public void ejbPassivate() {}
public void ejbRemove() {}
public void ejbStore() {}
public void setEntityContext(EntityContext ctx) {}
public void unsetEntityContext() {}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -