Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven


Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the code that im running SFSB on WLS8.1. SFSB is called from a standalone java client.
clients transfer money from checking to savings. in my db i have 20$ in Checking. I make an attmpt to transfer $60 from checking to savings.
public void transferToSaving(double amount) throws InsufficientBalanceException {
checkingBalance -= amount; savingBalance += amount;
try { updateChecking(checkingBalance); if (checkingBalance < 0.00) {
System.out.println("loop starting"); //THIS LOOP IS PUT DELIBERATELy, // so that I can check DB if value has been deducted from checking table
for (int i = 0 ; i < 1000000000; i++) { }
context.setRollbackOnly(); throw new InsufficientBalanceException(); } updateSaving(savingBalance); } catch (SQLException ex) { throw new EJBException ("Transaction failed due to SQLException: " + ex.getMessage()); }
At end of above method, i see -40 in my checking account, and savings account incremented by 60$
my question. why updated to checking table has not rolled back?
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the future please avoid cross-posting the same question to multiple forums. I have posted a response here.
Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!