• 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

Reading Uncommitted Data

 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Shiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic