Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

How to avoid dirty reads and incorrect commit in ejbs?  RSS feed

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my Application , in a Stateless Session Bean, I am handling the data transaction via DataAccess Object Class. During this process , I have to update two transactions in two different tables. While doing so, it is commiting the transaction in the first table but the second one fails ? I set the transaction attribute for the SLB methods as required. And also before two transaction is not over , I am not commiting the transactions ? While the start of the program itself , I kept db commit to off. How to avoid this incorrect transaction without changing SLB to EntityBean. Is there any settings in WAS4.0 to avoid the above transaction ? Can any one help me to solve this ?
TAI,
N.Ravisankar
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi "NRavi",
We have a naming policy here at JavaRanch where all publicly displayed names take the form, "Firstname Surname". Could you please edit your profile to bring it into line?
Thanks in advance and we hope that you enjoy your stay at the ranch!
Cheers
Simon
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as you�re using DAO�s you have the capacity to control the isolation level and the scope of the transaction, what gives you great flexibility, take a better look at the java.sql.Connection API(you can set the isolation level or demarcate the scope of the transaction with this one) and also at javax.transaction.UserTransaction(you can demarcate the scope of the transaction with this one) API, if you do a correct implementation and if you DB supports transactions you should be able to correct this problem.
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, you can have an introduction to the transaction concepts here
 
permaculture is largely about replacing oil with people. And one tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!