I am trying to design out our application and our database architecture but I am having some problems finding the correct solution to our problem.
In the Hibernate in Action book on page 172, first paragraph, it says that you may "implement a simple long pessimistic lock yourself, using Hibernate to manage the lock table. Patters for this can be found on the Hibernate website". I cannot find this on the website. Or am I looking at the wrong thing?
Our problem, we are creating an ERP web enabled product that will use EJBs to perform the business logic. Since there are also other process that can perform business logic that can take long periods of time then we have the problem of a user trying to modify information on a page and then a long term running process hits a spot where it is also manupilating the data.
We therefore are unable to use optomistic locking in our application.
What we need to do is start the user in a READ mode. When the user selects the button to put the screen in EDIT mode then we need to lock the record(s) that they see. The lock is eventually release when they either exit EDIT mode or press the save or delete buttons.
My reading shows that the pessimistic lock that hibernate creates is only kept for the transaction.
Suggestions?
Thank you,
David W.
|