Concurrent Access To Record.
I'am working on a typical workflow application .
Records can be added ,Updated , sanctioned, Authorized,
Deleted & viewed.
Business rules are :-
1)Only fresh & Sanctioned records can be modified
2)Only Sanctioned records can be Authorized
3)Only non Authorized records can be updated
4)Only non Authorized records can be Cancelled
5)Only non Authorized records can be Deleted.
Now assuming i want to Delete a non Authorized record,
I populate my transaction screen in Delete mode .
What i am actually doing is populating a Vector[]
from the database with field values for the particular record
and displaying it on the transaction screen
Now before I Delete this record if another user
Authorises the same record , my application logic goes for a toss.
This is because at the time both the records were
selected from the search screen , they were both
fresh records & both Deletion and Authorization was
possible .
How do i take care of this scenerio ?
I know that i could take care in the Delete Query by using the not in
Keyword & specify the required record status there .
but is there a cleaner way to do this ....
-
Another Fundamantal Question I have is
Typically , Entity Beans stand for
1) State of one row in the database
2) Listing Behaviour ( A Ship bean will have
a method which list's all it's cabin entity beans)
Now the question i have here is
client 'A' get's a remote referance to a Ship bean calls getCabins(),
and then loops & populates a select drop down in a JSP with the available cabins on a Ship . Assume the list diplays 100 cabins.
Simultaneously another user 'B' books a reservation on the
same ship & consequently there are only 99 free cabins.
What measure's should we take to ensure that Client 'A'
is not affected.He may as well select the same cabin as
the one selected by the Client 'A' & book a reservation.
How are web application's designed to handle this Scenerio ?
Basically in both my queries , what is happening is that the
Database is updated by another user before the first user
commits. How to tackle this scenerio ? any typical examples
+ sites mentioning explanations would are welcome.
Please gurus guide me ...as i am a newbie .!

