-The Session Bean is used to implement commercial objects that contain specific commercial logic. It cannot directly represent the shared data in the database. The Session object state is non-persistent and does not need to be written to the DB. The Session Bean implements the Bean business logic, while the remote access security parallel and transactions and other shame Bean containers provide
2. Compile EJB rules:
(1) compile Enterprise Bean:
1. One or more ejbCreate methods may exist.
2. The access control modifier must be public and cannot be static.
3. the parameter is a legal type of JavaRMI, And the modifier cannot be static or void.
4. The throws clause can include CreateException and other exceptions of the application.
5. The method cannot conflict with the definition of the EJB structure.
(2) Home interface: defines the required object EJB for client instantiation on the Create interface called by the client.
1. The parameters and return types of the Create method must be of the RMI type.
2. The Create method returns the Remote interface type (but the ejbCreate method returns void ).
3. The throw clause of the Create method must include remoteException and CreateException.
(3) Remote interface: defines commercial methods that can be called by the client.
1. The methods in the remote interface must match the methods implemented in the javasisre Bean class.
2. The methods in the Remote interface must be the same as the implementation methods in the Enterprise Bean class.
3. Parameters and return types must be valid RMI types.
4. The throws clause must include java. rmi. remoteException.
2. Select statful and stateless Session Bean.
1. stateul is designed to maintain objects that represent the client state and present non-persistent storage. A workflow that represents a business object.
It is generally used in the following cases:
(1). Maintain specific storage business objects.
(2) non-persistent storage objects.
(3) shows workflows between commercial objects.
2 stateless is designed to provide server-side behaviors without specific user information. It is generally used in the following cases:
(1) model reusable service objects.
(2) High Performance
(3) Multiple records are operated at a time.
(4) provide the DATE program viewpoint.