File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Seeking design pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Seeking design pattern" Watch "Seeking design pattern" New topic

Seeking design pattern

Dikran Seropian

Joined: Sep 23, 2002
Posts: 8
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?

Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
Can you do anything with transactions, either EJB container controlled or otherwise?
Dikran Seropian

Joined: Sep 23, 2002
Posts: 8
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...
I agree. Here's the link:
subject: Seeking design pattern
It's not a secret anymore!