All Examples  All EJB Examples  This Package

Class examples.ejb.basic.statelessSession.TraderBean


examples.ejb.basic.statelessSession.TraderBean


public class TraderBean
TraderBean is a stateless Session Bean. This bean illustrates:


Constructor Index

 o TraderBean()
 

Method Index

 o buy(String, int)
Buys shares of a stock for a named customer.
 o ejbActivate()
This method is required by the EJB Specification, but is not used by this example.
 o ejbCreate()
This method corresponds to the create method in the home interface "TraderHome.java".
 o ejbPassivate()
This method is required by the EJB Specification, but is not used by this example.
 o ejbRemove()
This method is required by the EJB Specification, but is not used by this example.
 o sell(String, int)
Sells shares of a stock for a named customer.
 o setSessionContext(SessionContext)
Sets the session context.

Constructor Detail

 o TraderBean

public TraderBean()

Method Detail

 o ejbActivate

public void ejbActivate()
          This method is required by the EJB Specification, but is not used by this example.
 o ejbRemove

public void ejbRemove()
          This method is required by the EJB Specification, but is not used by this example.
 o ejbPassivate

public void ejbPassivate()
          This method is required by the EJB Specification, but is not used by this example.
 o setSessionContext

public void setSessionContext(javax.ejb.SessionContext ctx)
          Sets the session context.
Parameters:
ctx - SessionContext Context for session
 o ejbCreate

public void ejbCreate() throws javax.ejb.CreateException
          This method corresponds to the create method in the home interface "TraderHome.java". The parameter sets of the two methods are identical. When the client calls TraderHome.create(), the container allocates an instance of the EJBean and calls ejbCreate().
Throws:
javax.ejb.CreateException - if there is a communications or systems failure
See Also:
Trader
 o buy

public TradeResult buy(java.lang.String stockSymbol,
                       int shares)
          Buys shares of a stock for a named customer.
Parameters:
customerName - String Customer name
stockSymbol - String Stock symbol
shares - int Number of shares to buy
Returns:
TradeResult Trade Result if there is an error while buying the shares
 o sell

public TradeResult sell(java.lang.String stockSymbol,
                        int shares)
          Sells shares of a stock for a named customer.
Parameters:
customerName - String Customer name
stockSymbol - String Stock symbol
shares - int Number of shares to buy
Returns:
TradeResult Trade Result if there is an error while selling the shares


All Examples  All EJB Examples  This Package