• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

transaction in EJB 2

 
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose i want to do something like updating few hundred records using my DAO class. I want a whole or nothing scenario -- either updating all or none.

1. If I do not use any EJB, what transaction method shall I use ? Can I use JTA ?

2. If I use a stateless session bean (EJB 2) for this action, how do I handle the transaction ? Shall I specify the transaction in config file ? If I specify it in config file, can I specify the transaction 'block' instead of a method ? i.e how do I ensure a small code block is in a transaction ? any example ?

Thanks.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


1. If I do not use any EJB, what transaction method shall I use ? Can I use JTA ?


If you like. Or a JDBC transaction would do.


2. If I use a stateless session bean (EJB 2) for this action, how do I handle the transaction ? Shall I specify the transaction in config file ? If I specify it in config file, can I specify the transaction 'block' instead of a method ? i.e how do I ensure a small code block is in a transaction ? any example ?


Your transaction demarcation is at the method level. You would need to write an EJB method to perform your update.
 
reply
    Bookmark Topic Watch Topic
  • New Topic