Vaadin grid - restrict concurrent modification of record

118 Views Asked by At

I need to restrict that multiple users can't edit same record at the same time. Any idea how to do that in vaadin grid, what would be the best approach? I'm using vaadin flow.

thanks

1

There are 1 best solutions below

0
On BEST ANSWER

This is not a Vaadin question. This is generic software architecture question.

You need to decide in which layer you will control this. You can rely on optimistic locking on data base layer. This allows Editing being enabled for everybody, but you get exception if someone did it first and then you handle the exception in some manner you like.

You can also create locking mechanism on service / business logic layer. Editing locks the service I.e. allow the editor open if service is not locked, release lock when cancel / save. This is called pessimistic locking.