Thanks, we have implemented the use of @Version. We have added this to a
Timestamp column. It works fine for updates, however when deleting the
row, a second user can update the row as it is still in his scope, the
row is merged with Entity Manager and it re-inserts the row. I was
hoping that this would also fail. The update fail message generated
actually says row has either been updated or deleted.

Any idea how I can get this to work.

Thanks.

Leon Dorfling 
Pepkor IT 
email : le...@pepkoritcom 
tel : (021) 937 9225 
fax : (021) 937 9213 
cell : 083 6789 270

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
Matthias Wessendorf
Sent: 25-August-2009 01:36 PM
To: MyFaces Discussion
Subject: Re: [Trinidad] Ensure Correctness of Data.

On Mon, Aug 24, 2009 at 6:07 PM, Leon Dorfling<[email protected]>
wrote:
> We are developing our first Java project using Trinidad.
>
>
>
> We are trying to resolve, a seemingly simple problem we have
encountered,
> but due to our lack of experience have not found the optimal solution.
>
>
>
> Our problem is, 2 users are viewing the same data. User1 deletes a
record
> from the database. The deleted record has not yet been deleted from
user2's
> page. Subsequentley user2 tries to update the record deleted by user1.
User2
> clicks on the record (deleted by user1) and navigates to a page to
update
> the record. The update page is rendered with data for the row after
the
> deleted row in the table.
>
>
>
> How do I ensure that if user2 tries to update a deleted record, he is
either
> warned that the records no longer exists or the data is refreshed
before he
> invokes an update process.

you need to implement a smarter solution here by your self. EG using
unique IDs, so that one could not load a deleted object by a (wrong)
ID.

Another would be to implement something like optimistic locking, see
here:
http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
(no, there is no need to use ActiveRecord for that. Can be done with
anything you are
using in the back-end).

But basically your application (design) has to take care of this.

-Matthias



>
>
>
> Thanks.
>
>
>
> Leon Dorfling
> Pepkor IT
> email : le...@pepkoritcom
> tel : (021) 937 9225
> fax : (021) 937 9213
> cell : 083 6789 270
>
>
>
> Pep a division of Pepkor Retail Limited.The legal status of this
> communication is governed by the terms and conditions
> published at
http://www.pepstores.com/cms/view/content/email_disclaimer,
> which terms and conditions relate,inter alia, to confidentiality and
> limitation of liability and include the names of directors and the
> registration number of the company.



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Pep a division of Pepkor Retail Limited.The legal status of this communication 
is governed by the terms and conditions
published at http://www.pepstores.com/cms/view/content/email_disclaimer, which 
terms and conditions relate,inter alia, to confidentiality and 
limitation of liability and include the names of directors and the registration 
number of the company.

Reply via email to