aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Uncommitted transaction state Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Uncommitted transaction state" Watch "Uncommitted transaction state" New topic
Author

Uncommitted transaction state

Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
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
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
There's no way to tell from this description. You'd have to show us code and/or log files to debug this.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
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
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
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

Joined: May 22, 2006
Posts: 68
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

Joined: May 22, 2006
Posts: 68
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uncommitted transaction state