Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading Uncommitted Data

 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have large process X running inside an EJB and I would like to monitor its status from the web by checking the values of certain rows in the database. The problem is the default settings make it so that I can only see the changed values after the process X is finished. In short, I want to read the data from the entity manager from the web (which is using the same EJB session bean) while process X is still running.

I couldn't find a way to change the isolation for a single transaction (missing feature?), but I did see I can modify isolation-level in the data source XML file to "TRANSACTION_READ_UNCOMMITTED". The problem is, this still does not work by itself, I also have to call entityManager.flush(). Calling flush hundreds/thousands of times during a transaction seems like it would hurt DB performance, shouldn't the web application (which is accessing the same session bean as process X) be able to read the entity manage data without the call to flush?
 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, the only other solution that I know works and doesn't hit the database/flush unnecessarily is track the progress in a static/singleton object. This seems to defeat the purpose of having an 'entity manager' though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic