• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transaction Isolation  RSS feed

 
Meghna Kurup
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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.
 
Kirt Henrie
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
 
gautam shah
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • 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.
 
zingaroo
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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.....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!