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
20
Transaction Attributes and Scope
Transaction
Attribute
Client's
Transaction
Business Method's
Transaction
none
T2
Required
T1
T1
none
T2
RequiresNew
T1
T2
none
error
Mandatory
T1
T1
none
none
NotSupported
T1
none
none
none
Supports
T1
T1
none
none
Never
T1
error
Setting Transaction Attributes
Because transaction attributes are stored in the deployment descriptor, they can be changed during several
phases of J2EE application development: enterprise bean creation, application assembly, and deployment.
However, as an enterprise bean developer, it is your responsibility to specify the attributes when creating the
bean.
The attributes should be modified only by an application developer who is assembling components into
larger applications.
Do not expect the person who is deploying the J2EE application to specify the transaction attributes. You can specify the transaction attributes for the entire enterprise bean or for individual methods. If you've specified one attribute for a method and another for the bean, the attribute for the method takes
precedence.
When specifying attributes for individual methods, the requirements for session and entity beans vary.
Session beans need the attributes defined for business methods, but do not allow them for the create methods. Entity beans require transaction attributes for the business, create, remove, and finder methods.
Rolling Back a Container-Managed Transaction
There are two ways to roll back a container-managed transaction.
First, if a system exception is thrown, the container will automatically roll back the transaction. Second, by invoking the setRollbackOnly method of the EJBContext interface, the bean method
instructs the container to roll back the transaction. If the bean throws an application exception, the roll back is not automatic, but may be initiated by a call to setRollbackOnly.
When the container rolls back a transaction, it always undoes the changes to data made by SQL
calls within the transaction. However, only in entity beans will the container undo changes made to instance variables. (It does so by automatically invoking the entity bean's ejbLoad method, which loads the instance variables from the database.)
When a rollback occurs, a session bean must explicitly reset any instance variables changed within
the transaction. The easiest way to reset a session bean's instance variables is by implementing the SessionSynchonization interface.
|
|
|
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
|