📄 portfoliobean.java
字号:
/*
* @author : Pushkala
* @version : 1.0
*
* Development Environment : Oracle9i JDeveloper
*
* Name of the File : PortfolioBean.java
*
* Creation / Modification History
* Pushkala 26-Apr-2002 Created
*
*/
package oracle.otnsamples.ibfbs.trademanagement.ejb;
import javax.ejb.EntityContext;
import java.util.Date;
/**
* This Class acts as Bean Implementation for PortfolioBean which is a local
* EJB Object. UserAccount is an Entity Object. Every User Account can have
* multiple Portfolio and this 1:N relationship between User Account Entity Bean
* and Portfolio Bean is managed by the EJB Container.
* This is a CMP Bean where persistence is managed by the EJB Container.
* This Entity represents the PORTFOLIO Table in the database.
*
* This new feature called CMR (Container Managed Relationships) is a new feature
* added in EJB 2.0 Specification.
*
* Note that
* A) This class is defined as abstract since the Container actually
* implements most of the logic for managing relationships (CMR).
* This feature is added in EJB 2.0 Specification
* B) This Class also do not declare the instance variables such as accountNumber,
* symbol etc. In earlier approach EJB 1.1, the entity bean used to declare
* the instance variables mapping to variables in the Entity object.
* This was removed in EJB 2.0 Specification.
*
* @version 1.0
* @since 1.0
*/
public abstract class PortfolioBean implements javax.ejb.EntityBean {
/**
* This method is called by the Container when the client invokes create()
* method on the home interface.
*
* @param accountNumber User Account Number
* @param id Id
* @param lineNumber Line Number
* @param quantity Quantity
* @param price Price
* @param symbol Symbol
* @param purchaseDate Purchase Date
* @param purchaseMode Purchase Mode
* @param tradeId Trade Id
* @return Value of Primary Key, Here it returns null
* @since 1.0
*/
public Integer ejbCreate(Integer accountNumber, Integer id,
Integer lineNumber, Integer quantity, float price,
String symbol, Date purchaseDate,
String purchaseMode, Integer tradeId) {
setId(id);
setAccountNumber(accountNumber);
setLineNo(lineNumber);
setQuantity(quantity);
setPrice(price);
setSymbol(symbol);
setPurchaseDate(purchaseDate);
setPurchaseMode(purchaseMode);
setTradeId(tradeId);
return null;
}
/**
* This method is called by the Container after invoking of ejbCreate().
* This method has the same signature as ejbCreate() method.
*
* @param accountNumber User Account Number
* @param id Id
* @param lineNumber Line Number
* @param quantity Quantity
* @param price Price
* @param symbol Symbol
* @param purchaseDate Purchase Date
* @param purchaseMode Purchase Mode
* @param tradeId Trade Id
* @since 1.0
*/
public void ejbPostCreate(Integer accountNumber, Integer id,
Integer lineNumber, Integer quantity,
float price, String symbol, Date purchaseDate,
String purchaseMode, Integer tradeId) {
}
/**
* Declare Abstract Methods for persistent fields. Note that the persistent
* fields are id, accountNumber, lineNo, quantity, price, Symbol, purchaseDate,
* purchaseMode, tradeId.
* These methods are implemented by the EJB Container itself Unlike in EJB 1.1,
* where it was the responsibility of the bean itself to manage these fields.
* The method definition is provided by the container.
*/
/**
* Method to get the User Account Number of the current Portfolio.
*
* @return The Account Number
* @since 1.0
*/
public abstract Integer getAccountNumber();
/**
* Method to set the Account Number of the current Portfolio.
*
* @param accountNumber User Account Number
* @since 1.0
*/
public abstract void setAccountNumber(Integer accountNumber);
/**
* Method to get the Id of the current Portfolio.
*
* @return The value of the primary key, id of the Portfolio
* @since 1.0
*/
public abstract Integer getId();
/**
* Method to set the id of the current Portfolio.
*
* @param id Id
* @since 1.0
*/
public abstract void setId(Integer id);
/**
* Method to get the Line No of the current Portfolio.
*
* @return The Line No for the Portfolio
* @since 1.0
*/
public abstract Integer getLineNo();
/**
* Method to set the Line Number of the current Portfolio.
*
* @param lineNumber Line Number
* @since 1.0
*/
public abstract void setLineNo(Integer lineNumber);
/**
* Method to get the Stock Quantity of the current Portfolio.
*
* @return The Stock Quantity
* @since 1.0
*/
public abstract Integer getQuantity();
/**
* Method to set the quantity of stocks in the current Portfolio.
*
* @param quantity Quantity of Stocks
* @since 1.0
*/
public abstract void setQuantity(Integer quantity);
/**
* Method to get the Stock Price of the current Portfolio.
*
* @return The Stock Price
* @since 1.0
*/
public abstract float getPrice();
/**
* Method to set the price at which stocks were bought in the
* current Portfolio.
*
* @param price Buy Price
* @since 1.0
*/
public abstract void setPrice(float price);
/**
* Method to get the Stock Symbol of the current Portfolio.
*
* @return Stock Symbol
* @since 1.0
*/
public abstract String getSymbol();
/**
* Method to set the Stock Symbol in the current Portfolio.
*
* @param symbol Stock Symbol
* @since 1.0
*/
public abstract void setSymbol(String symbol);
/**
* Method to get the Purchase Date of the current Portfolio.
*
* @return Purchase Date
* @since 1.0
*/
public abstract Date getPurchaseDate();
/**
* Method to set the purchase date of stocks in the current Portfolio.
*
* @param purchaseDate Purchase Date
* @since 1.0
*/
public abstract void setPurchaseDate(Date purchaseDate);
/**
* Method to get the Purchase Mode of the current Portfolio.
*
* @return Purchase Mode
* @since 1.0
*/
public abstract String getPurchaseMode();
/**
* Method to set the purchase mode of stocks in the current Portfolio.
*
* @param purchaseMode Purchase Mode
* @since 1.0
*/
public abstract void setPurchaseMode(String purchaseMode);
/**
* Method to get the Trade Id corresponding to the current Portfolio.
*
* @return Trade Id
* @since 1.0
*/
public abstract Integer getTradeId();
/**
* Method to set the Trade Id of stocks in the current Portfolio.
*
* @param tradeId Trade Id
* @since 1.0
*/
public abstract void setTradeId(Integer tradeId);
/**
* Standard CallBack methods
* @since 1.0
*/
public void setEntityContext(EntityContext ec) {}
public void unsetEntityContext() {}
public void ejbLoad() {}
public void ejbStore() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void ejbRemove() {}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -