detail.php
OW2 Forge: Detail: 314109 Can't read uncommitted data within it's own transaction

Advanced - Powered by Google


   
Log In
New Account
  
 
Home
My Page
Project Tree
Project Openings
JOTM
          
 
 
Summary
Tracker
Lists
Tasks
News
CVS
Files
SVN
                
 

Tracker: Bugs

Submit New | Browse | Admin | ExportToXml

[ #314109 ] Can't read uncommitted data within it's own transaction

Date:
2009-07-31 12:57
Priority:
5
Submitted By:
Magnus (mage)
Assigned To:
Nobody (None)
Category:
JOTM
State:
Open
Summary:
Can't read uncommitted data within it's own transaction

Detailed description:
I am using spring version 2.5.6, spring-jpa version 2.0.8 and a jotum 2.0.10 JTA transaction manager. In short: I have a server layer function with Propagation.REQUIRED that invokes a DAO to insert data in two tables. After invoking the DAO to perform the insert I invoke the same DAO and try to read the data but it's not there, apparently because it has not been committed yet. It should however be visible since I am still in the same transaction so to me it seems like a bug. A more detailed description of my test case: I have a addCustomer() function in the service layer that invokes a customerDAO bean to create a customer entry in two tables (see below). I also have a service layer function getCustomers() that fetches all the customers but when I try to invoke it from addCustomer(...) after inserting a new customer it does not return the newly added customer. (There is of course no need for me to invoke getCustomers() from addCustomer(...), I did this just for testing after noticing this problem when writing a JUint test with annotations: @Test @Rollback(true) @Transactional) After some investigations I see that I can read the uncommitted customer data added by customerDAO.insert(customer) in one of the tables it updates but not in the second table. All beans, both service layer and DAO's are using Propagation.REQUIRED Service layer functions: @Transactional(propagation = Propagation.REQUIRED) public void addCustomer(...) { customerDAO.insert(customer); Collection<Customer> customers = getCustomers(); } @Transactional(propagation = Propagation.REQUIRED) public Collection<Customer> getCustomers() { return customerDAO.getAll() } CustomerDAO functions: @Transactional(propagation = Propagation.REQUIRED) public void insert(Customer customer) { // insert customer data in one table using a separetate DAO anotherCustomerDAO.insert(customer) // Then continue to insert data in the second customer table ... } @Transactional(propagation = Propagation.REQUIRED) public Collection<Customer> getAll() { // This function reads the data from both tables with a singe SQL statement, i.e. it does not use anotherCustomerDAO }

Add A Comment:

Please login

Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item

Copyright © 1999-2008, OW2 Consortium | contact | You have a difficulty, a problem ? Please report an issue using your OW2 forge account credentials