Table 2.3 and Table 2.4 summarize the operations that are legal for a stateless session bean.
Table B-3. Allowed Operations for Stateless Session Beans in EJB 1.1
Allowed Operations | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Method |
Container-Managed Transactions |
Bean-Managed Transactions | |||||||||||||||||||
|
JNDI ENC contexts:
|
JNDI ENC contexts:
| |||||||||||||||||||
|
JNDI ENC contexts:
|
JNDI ENC contexts:
| |||||||||||||||||||
business methods |
JNDI ENC contexts:
|
JNDI ENC contexts:
| |||||||||||||||||||
|
Not Supported (stateless beans do not use these methods) |
Not Supported (stateless beans do not use these methods) |
Table B-4. Allowed Operations for Stateless Session Beans in EJB 1.0
Allowed Operations | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Method |
Container-Managed Transactions |
Bean-Managed Transactions | |||||||||||||
|
|
| |||||||||||||
|
|
| |||||||||||||
business methods |
|
| |||||||||||||
|
Not Supported (stateless beans do not use these methods) |
Not Supported (stateless beans do not use these methods) |
Table 2.5 and Table 2.6 summarize the operations that are legal for a stateful session bean in EJB 1.1 and 1.0.
Table B-5. Allowed Operations for Stateful Session Beans in EJB 1.1
Allowed Operations | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Method |
Container-Managed Transactions |
Bean-Managed Transactions | |||||||||||||||||||
|
JNDI ENC contexts:
|
JNDI ENC contexts:
| |||||||||||||||||||
|
JNDI ENC contexts:
|
JNDI ENC contexts:
| |||||||||||||||||||
business methods |
JNDI ENC contexts:
|
JNDI ENC contexts:
| |||||||||||||||||||
|
JNDI ENC contexts:
|
Not Supported (bean-managed transaction beans can not implement the SessionSynchronization interface) | |||||||||||||||||||
|
JNDI ENC contexts:
|
Not Supported (bean-managed transaction beans can not implement the SessionSynchronization interface) |
Table B-6. Allowed Operations for Stateful Session Beans in EJB 1.0
Table 2.7 summarizes what happens to a transaction if an exception is thrown while the transaction is in process.
Table B-7. Exceptions and Transactions
Transaction Scope |
Transactional Type Attributes |
Exception Thrown |
Container’s Action |
Client’s View | ||||
---|---|---|---|---|---|---|---|---|
Client Initiated Transaction Transaction is started by the client (application or bean) and is propagated to the bean method. |
transaction-type =
transaction-attribute =
|
Application Exception |
If the bean invoked Rethrow Application Exception. |
Receives the Application Exception. The client’s transaction may or may not have been marked for rolled back. | ||||
System Exception |
Mark the client’s transaction for roll back. Log the error. Discard the instance. Rethrow |
Receives the The client’s transaction has been rolled back. | ||||||
Container Initiated Transaction The transaction started when the bean’s method was invoked and will end when method completes. |
transaction-type =
transaction-attribute =
|
Application Exception |
If bean called If bean didn’t explicitly rollback the transaction, then attempt to commit the transaction and rethrow the Application Exception. |
Receives the Application Exception. The bean’s transaction may or may not have been rolled back. The client’s transaction is not affected. | ||||
System Exception |
Roll back the transaction. Log the error. Discard the instance. Rethrow |
Receives the The bean’s transaction was rolled back. The client’s transaction is not affected. | ||||||
Bean is not part of a transaction The bean was invoked but does not propagate the client’s transaction and does not start its own transaction. |
transaction-type =
transaction-attribute =
|
Application Exception |
Rethrow Application Exception |
Receives the Application Exception. The client’s transaction is not affected. | ||||
System Exception |
Log the error. Discard the instance. Rethrow |
Receives the The client’s transaction is not affected. | ||||||
Bean Managed Transaction. The stateful or stateless session bean use the EJBContext to explicitly manage its own transaction. |
transaction-type =
transaction-attribute =
|
Application Exception |
Rethrow the Application Exception. |
Receive the Application Exception. The client’s transaction is not affected. | ||||
System Exception |
Roll back the transaction. Log the error. Discard the instance. |
Receives the |