Browse Today's favorites or All time favorites.
Please Sign In or Register to share and submit your questions.
Java Queries
Complete java interview questions library
What are transactional attributes?
EJB transactions are a set of mechanisms and concepts, which insures the integrity and consistency of the database when multiple clients try to read/update the database simultaneously.
Transaction attributes are defined at different levels like EJB (or class), a method within a class or segment of a code within a method. The attributes specified for a particular method take precedence over the attributes specified for a particular EJB (or class). Transaction attributes are specified declaratively through EJB deployment descriptors. Unless there is any compelling reason, the declarative approach is recommended over programmatic approach where all the transactions are handled programmatically. With the declarative approach, the EJB container will handle the transactions.
Required: Methods executed within a transaction. If client provides a transaction, it is used. If not, a new transaction is
generated. Commit at end of method that started the transaction. Which means a method that has Required
attribute set, but was called when the transaction has already started will not commit at the method
completion. Well suited for EJB session beans.
Mandatory: Client of this EJB must create a transaction in which this method operates, otherwise an error will be
reported. Well-suited for entity beans.
RequiresNew: Methods executed within a transaction. If client provides a transaction, it is suspended. If not a new
transaction is generated, regardless. Commit at end of method.
Supports: Transactions are optional.
NotSupported: Transactions are not supported. If provided, ignored.
Never: Code in the EJB responsible for explicit transaction control.
Make a good first impression during an office interview
- important to be punctual and arrive a few minutes early.
- Confirm directions or drive to the location on the previous day to ensure you know where you are going.
- Put your best foot forward. Dress appropriately for the position you are seeking.
Write a comment