aspose file tools*
The moose likes JDBC and the fly likes how to implement Concurrent access to records..Please help me URGENTLY Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to implement Concurrent access to records..Please help me URGENTLY" Watch "how to implement Concurrent access to records..Please help me URGENTLY" New topic
Author

how to implement Concurrent access to records..Please help me URGENTLY

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi All,
I have a scenario as below
Please help me out to implement this ;-)

-------------------
Scenario
-------------------
1> 2 users are accessing a single record (in a web based J2EE App) at the same time
2> 1 user should be able to see one of the records in READ ONLY MODE and the other user in WRITE ONLY MODE

Assuming 1st user access's 1st Record hence RECORD1.WRITE_ONLY_MODE -- EDITABLE

Assuming 2nd user access's 1st Record hence should be RECORD1.READ_ONLY_MODE -- NON EDITABLE

3> When the 1st user is accessing the 1st record,He enters the details of the 1st record,and clicks on "save button",The data gets saved to the db.
;When the 2nd user access the 1st record at the same instance of time,he should be displayed with a message saying " RECORD IS LOCKED BY ANOTHER USER,Trying Accessing After Sometime"

5>The 1st user after saving the data for 1st record comes out of the record profile.now if the 2nd user tries to "REFRESH" The Jsp page and tries to access the same 1st RECORD ,He should be displayed with the message "RECORD IS AVAILABLE FOR CHANGES."


How do i go about in implementing this in a J2EE Web based application.

IN CASE IF U KNOW THE IMPLEMENTATION LOGIC.PLEASE PROVIDE THE SAME


When The Going Gets Tougher,The Tougher gets Going
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39884
    
  28
Please read the important administrative private message I am sending you in a minute or two.

Don't go round saying things are urgent.
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi Campbell,
Is my displayed name now correct??
Guys please help me around with this query....
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3263
What persistence framework are you using? Hibernate, JDBC, etc. Read up on the database isolation levels and ACID properties. If you are using Hibernate, you can use its optimistic locking strategy. Also have a look at "select for update ...."
[ September 20, 2008: Message edited by: arulk pillai ]

500+ Java Interview Questions and Answers | Java job hunting know how & Java resumes
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi arulk pillai
Assume its a simple J2EE web based application built using jsp's and servlets,

How would you implement Concurrent access feature to records.??
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I think what this interview/assignment question is trying to get you to talk about is locking strategies. In which case arulk pillai has already mentioned one, and hinted at another. I'd have a google for them and see what you learn, or alternatively try searching this forum.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi guys,
I'm unable to get any information ,Please help me.
Deepak lal
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Originally posted by arulk pillai:
What persistence framework are you using? Hibernate, JDBC, etc. Read up on the database isolation levels and ACID properties. If you are using Hibernate, you can use its optimistic locking strategy. Also have a look at "select for update ...."

[ September 20, 2008: Message edited by: arulk pillai ]


Have a google for the highlighted terms.
[ September 22, 2008: Message edited by: Paul Sturrock ]
 
 
subject: how to implement Concurrent access to records..Please help me URGENTLY