Earn Money
Trading Forex Online
Paramount Airways
Free Data Recovery
Cargo
Job Portal
HSBC Investment
Management
Cheap Web Hosting
Make Trip
Cheap Air Travel
Leisure Hotel
Free Air Travel
Mutual Fund Informations
Cheapest Cellular Plan
Free Sexy Indians
Call Center Software
Hot Indian
|
Programming Help |
Homework Help |
Counseling
Astrology Advice |
Tarot Advice |
Parenting
Dating Advice |
Love Advice |
Divorce Advice
Legal Advice |
Debt Advice |
Career Advice
Enterprise Beans Tutorial
18
Transactions
Because the steps within a transaction are a unified whole, a transaction is often defined as an indivisible
unit of work
.
A transaction can end in two ways: with a commit or a rollback. When a transaction commits, the data
modifications made by its statements are saved. If a statement within a transaction fails, the transaction rolls back, undoing the effects of all statements in the transaction.
the begin and commit statments mark the boundaries of the transaction. When deploying an enterprise bean,
you determine how the boundaries are set by specifying either container-managed or bean-managed transactions.
## Container-Managed Transactions ##
In an enterprise bean with container-managed transactions, the EJB container sets the boundaries of the
transactions.
You can use container-managed transactions with both session and entity beans. Container-managed transactions simplify development because the enterprise bean code does not explicitly
mark the transaction's boundaries.
The code does not include statements that begin and end the transaction. Typically, the container begins a transaction immediately before an enterprise bean method starts. It
commits the transaction just before the method exits. Each method can be associated with a single transaction.
Nested or multiple transactions are not allowed within a method. Container-managed transactions do not require all methods to be associated with transactions. When
deploying a bean, you specify which of the bean's methods are associated with transactions by setting the transaction attributes.
Transaction Attributes
A transaction attribute controls the scope of a transaction. Method-A of Bean 1 begins a transaction and then
invokes method-B of Bean-2. When method-B executes, does it run within the scope of the transaction started by method-A or does it execute with a new transaction? The answer depends on the transaction attribute of method-B.
Transaction Attribute Values
A transaction attribute may have one of the following values:
Required
RequiresNew
Mandatory
NotSupported
Supports
Never
Required
If the client is running within a transaction and it invokes the enterprise bean's method, the method
executes within the client's transaction.
If the client is not associated with a transaction, the container starts a new transaction before
running the method.
The Required attribute will work for most transactions. Therefore, you may want to use it as a
default, at least in the early phases of development. Because transaction attributes are declarative, you can easily change them at a later time.
|
|
|
Earn Money
Trading Forex Online
Paramount Airways
Free Data Recovery
Cargo
Job Portal
HSBC Investment
Management
Cheap Web Hosting
Make Trip
Cheap Air Travel
Leisure Hotel
Free Air Travel
Mutual Fund Informations
Cheapest Cellular Plan
Free Sexy Indians
Call Center Software
Hot Indian
|