• 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 Issues with session EJB.

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have implemented Stateless Session EJBs with DAO (Simple JAVA classes) objects, wherein one of my stateless EJB method calls methods of multiple DAO (say CustomerDAO and OrderDAO).
First we are saving info in CustomerDAo and then into OrderDAO. While saving info in OrderDAO, if there are any exceptions then i want my transaction to be rolledback completely (i.e. entry in CustomerDAO should not be committed). I have tried to implement this by marking my sessioncontext as setRollbackOnly.
Right now if there is some problem in OrderDAO then my transaction is committed automatically (if autocommit is set to true). If i set it to false then it is not committed even if there is no error.
My transaction is specified as Container Managed - Required for all methods. Each of my DAOs are having their own connection object, set to AutoCommit "false". Also after putting connection to AutoCommit "FALSE", ORderDAO locks the corresponding Table.
Pls. inform any solution or work around for the same.
If i use Entity EJBs with Local Interface will it be of similar performance as my DAOs.
Eagerly waiting for any response.
Thanks & regards,
Tarun Dewan.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tarun,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the EJB forum.
 
And then the flying monkeys attacked. My only defense was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic