Friday, March 02, 2007

JAVA 認證心得 -- SCBCD (7)

Session Bean Lifecycle
##CONTINUE##

  • The ejbRemove() method may not be called on a stateful session bean instance in the following cases:
    1. The EJB Container crashes
    2. A system exception is thrown from the instance’s method
    3. The bean times out while in passivated state
  • In session beans it is mandatory to specify transaction attributes for the business methods defined in the component interface. Transaction attribute must not be specified for methods defined in javax.ejb.EJBObject and javax.ejb.EJBLocalObject interface.
  • It is required that the object returned from the getEJBObject method of SessionContext interface must be cast to the session bean's remote component interface using Java language cast. It is not required to use PortableRemoteObject's narrow (...) method on the object returned by the getEJBObject method of SessionContext interface
  • A stateful session bean instance cannot be removed while the instance is associated with a transaction
  • Each create method defined in the remote home interface must have a matching method with the same name, number and type of arguments but the return type is different. The return type of create methods defined in the remote home interface is the stateful session bean's remote component interface but the return type of ejbCreate methods is void.

Read more!

No comments: