• 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

Uncommitted transaction state

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem I am getting is that in a single transaction, if there are suppose 4 insert statements fired, and in next sequence select query is fired on same table then that select returns only 3 records and not 4 (total uncommitted records) which is wrong, it does not return the last inserted record to select query. But while committing it saves all 4 records.
What will be the problem why select gets only 3 records instead of 4?
We are using EJB 2.1
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no way to tell from this description. You'd have to show us code and/or log files to debug this.
 
Deepa More
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The transaction is like this:
In a first class it calls mstHome.create(..,..,..,....) method to insert a record in a table for say 4 times in loop.
This successfully creates records. Still data is not committed.
Then the next class in chain fires JDBC select statement on the same table to get newly entered ids- which returns only 3 records instead of 4.
Finally while committing, 4 records gets committed.

I am bit confused about the behavior of transaction as if there are 3 inserts, select returns 2 records and so.
As the project is large & complex, I'll not be able to post exact code here. And there are no errors in between transaction processing.

Thanks in advance,
Deepa
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is starting to get a little clearer -- your example helped. What verison of WAS are you using and what Database (and driver) are you using?
 
Deepa More
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are using the WAS version 6.0 and database is DB2 using JDBC driver type 4 - "DB2 UDB" and jars used are :
db2jcc.jar, db2jcc_license_cu.jar, db2java.zip.

Thanks
Deepa
[ August 18, 2008: Message edited by: Deepa More ]
 
Deepa More
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem solved.
It needs some flushing to be done for cached data.
So I called one finder method after insertion of records. Now it returns all records properly.

Thanks again.
Deepa
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic