The moose likes EJB and Other Java EE Technologies and the fly likes EJB Transaction Attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "EJB Transaction Attribute" Watch "EJB Transaction Attribute" New topic
Author

EJB Transaction Attribute

Ariram Kalimuthu
Greenhorn

Joined: Jul 17, 2009
Posts: 19
Hi Folks,
i need a clarification on below Transactionattributre in EJB 3

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)

EJB container will create the new tarnsaction for any requests, if we use the above attribute.

My Question is,
It is required to use for only insert, delete,and update operation from database.
shall we use for fetch(select * from table) operation in database?

ie., if we use the for fetching operation, container will create new transaction.

JTA will be taking care about rollback/commit related operations.
but my case there is no chance to happen rollback operation

Please suggest me to shall i go a head to use this attribute in my EJB ot not?

Thanks in Advance!



ARIRAM K
SCJP 5.0, SCWCD 5.0 & Preparing for SCBCD 5.0
Ralph Jaus
Ranch Hand

Joined: Apr 27, 2008
Posts: 342
If there are only reading operations from a database and no other resources hava to be synchronized then it's better not to use transactions in the concerning ejb method. It's not only JTA overhead but also overhead for maintaining the persistence context (if you're using JPA).

Transaction attributes that prevent using transactions are NEVER and NOT_SUPPORTED. But in general it's safer to use NOT_SUPPORTED.


SCJP 5 (98%) - SCBCD 5 (98%)
 
 
subject: EJB Transaction Attribute
 
Threads others viewed
Question about Transactions in EJB / MDB scenario
K&B: A question about Transaction
Stateless Session Beans Managing JDBC Transactions
Question about transactions (CMT). Am I wrong in understanding "Transactions" at all?
transaction in Container managed session bean
developer file tools