Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seeking design pattern

 
Dikran Seropian
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My probl. regards a design sol. for a j2ee system. The main issue is that the database is concurently accesible by 2 applications (including my j2ee client). Moreover, the other app has the freedom to make changes to the data (including changing PK) whenever it wishes.
I must not make any change in the db model.
I am seeking some pattern to control reads/updates without any of the apps using the db to get locked on some row or the final client loosing too much work because the data he worked on has been changed in the meanwhile.
What would you suggest?
Thanks,
 
Tina Coleman
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you do anything with transactions, either EJB container controlled or otherwise?
 
Dikran Seropian
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tina,
Yes, this db seems to be jdbc30 compliant. I think I have only 2 solutions: for non critical actions to use an optimistic lock, so my client will lose his work in case the underlying data has changed before he commited, and for critical actions use pesimistic lock, so anybody else will have to delay their updates until my client gets finished. The only thing I can do more about it would be to set some time limit for the transaction. However, all of it needs to be hardcoded, no CMP, no JDO, no caching...
cheers,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic