• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

EJB Transaction Attribute

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!


 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic