This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Transaction Isolation

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,
In our web-application, I am using a stored procedure to update 5 nos. tables, when one of the values in the parent table changes. The procedure is set as a single unit of work.
Now at any given point of time, some entity beans or the other will access the above mentioned 5 tables to retrieve data.
The question is:
Does the EJB Container ensure that the next time any of the entity beans access these tables, they all will get the latest updated data?
OR PUTTING THE QUESTIONS IN A DIFFERENT STYLE
Since the Stored procedure will modify data in multiple tables,how will the EJB Container ensure that the already instantiated entity beans based on these tables be synchronized to get latest updated data?
Please come forward and put in your valuable suggestions.
Thanx in adv.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that each time you invoke a method on your entity bean it will synchronize its fields with the database, it will then re-synchronize at the completion of the transaction.
In some containers I have used you can specify that the table can not be updated outside of the container which will subvert this behavior and increase performance.
- KJ
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Meghna Kurup:
Hi Everyone,
In our web-application, I am using a stored procedure to update 5 nos. tables, when one of the values in the parent table changes. The procedure is set as a single unit of work.
Now at any given point of time, some entity beans or the other will access the above mentioned 5 tables to retrieve data.
The question is:
Does the EJB Container ensure that the next time any of the entity beans access these tables, they all will get the latest updated data?
OR PUTTING THE QUESTIONS IN A DIFFERENT STYLE
Since the Stored procedure will modify data in multiple tables,how will the EJB Container ensure that the already instantiated entity beans based on these tables be synchronized to get latest updated data?
Please come forward and put in your valuable suggestions.
Thanx in adv.


it is not the programmer who has to take care of all that. if we r using entity beans then this is the duty of container to maintain the field in the beans with corresponding columns in the table.
actully upon every call of remote methods container calls ejbLoad() to synchronize the states of bean fields with the database.
and transaction isolation level is a entirely different thing with different reasons that which one level u should choose.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u can do this by setting the <db-is-shared>true</db-is-shared>.What this does is it will call the ejbLoad() before any business method call.
though this is an option but i do not like it as this increases the no of DB hits a lot.....
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic