Questions tagged [optimistic-locking]

When coordinating updates from multiple database sessions, optimistic locking is a strategy that assumes all updates can complete without conflict. It does not hold locks on any records while the user is editing, but checks to see if any other edits have occurred when the user tries to commit the changes. If two sessions try to edit the same data, the second one to commit will be rejected and have to redo the change. Also see pessimistic locking.

422 questions
0
votes
1 answer

Row Locking in jQGrid Edit

I want to implement row locking for jQGrid edits. Since my back end uses JDBC, I am thinking of using optimistic locking on the back end and if the lock is not obtained, then displaying an error message on the grid. Is this the best way to do it or…
AbtPst
  • 7,778
  • 17
  • 91
  • 172
0
votes
1 answer

JPA: any complete example of using @Version to prevent simultaneous edits to the same record?

I have a class that has the following field: @Version private Long version = 1L; public Long getVersion() { return version; } public void setVersion(Long version) { this.version = version; } I use Spring web + Hibernate. I hope to see a…
curious1
  • 14,155
  • 37
  • 130
  • 231
0
votes
1 answer

Rails optimistic locking manual lock check: any issues?

I have a rails app where a particular form submit for a model is a two step process: on the first submit, the rails controller issues a render of a modal confirmation form, from which either the update action is invoked or the whole thing…
Bogatyr
  • 19,255
  • 7
  • 59
  • 72
0
votes
1 answer

Hibernate @Version causing database foreign key constraint failure

I have two hibernate/JPA entities @Entity @Table(name = "conference_room", uniqueConstraints = @UniqueConstraint(columnNames = "code")) class ConferenceRoom { @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true,…
Himanshu
  • 45
  • 1
  • 1
  • 7
0
votes
0 answers

How to avoid optimistic lock exception

I am trying to mock the webservice call,and developed a sample client which forms a dummy request and gets response now what i do is i implement callable in this client class and put all my business logic in call and request formation in…
0
votes
1 answer

Does optimistic locking prevent blocking in JPA?

I am a bit confused on the benefits of optimistic locking in JPA. I conducted a test with two threads and a single row on a versioned entity table. Here is what I have found: T1: begin tran T1: fetch single entity T1: Update field in entity T1:…
Darren
  • 722
  • 4
  • 12
0
votes
1 answer

What does Stateless bean operate with EntityManageer that could resolve the issue with "user-think-time"

Reading these notes. On the EBean site page. There is a paragraph that contains: "The natural way to manage the EntityManager with a EJB3 container is to use a Stateful Session Bean." Also there was an exposed problem like "How to manage…
ses
  • 13,174
  • 31
  • 123
  • 226
0
votes
1 answer

Optimistic Locking : Two fields that need to be updated

In our old db strukture we have two fields in one table that get updated when we change data. create table dbo.example( name varchar(50), ..., changed smalldatetime, -- here we save the last update date version int -- and…
Hasan Tuncay
  • 1,090
  • 2
  • 11
  • 30
0
votes
1 answer

Optimistic locking in web applications

We are building a customer provisioning tool for our multi-tenant application. Multiple users can work on the same configuration and hence we want to avoid conflicts. We know that optimistic locking is the way to go. But wondering how to show the…
Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
0
votes
1 answer

How to throw OptimisticLockException with hibernate-jpa2.0

I'm currently working on an optimistic-locking management in my project. We use JPA 2.0 (hibernate-jpa2.0-api-1.0.1.Final) and the datasource is provided by JBoss 7. What I did In my entity "AccordSimple" I use the @Version…
user1180339
  • 319
  • 1
  • 6
  • 16
0
votes
1 answer

How to apply @InitBinder to protect @Version field in a Spring MVC, Hibernate app?

In a Spring 3.1 MVC app with Hibernate 4.1, I am using: Declarative transaction management Session per request Optimistic locking by adding the "version" property in the domain objects Reattaching detached domain object using saveOrUpdate() Domain…
mike.l
  • 219
  • 1
  • 4
  • 11
0
votes
1 answer

Input on how to keep object map in sync between browser (javascript) and server (asp.net web service/database)?

I have a object map on my server (objects representing Customers, Orders, Items, related to each other, based on content from a database) and want to keep an up to date version of that object map in the browser where the user is manipulating and…
Egil Hansen
  • 15,028
  • 8
  • 37
  • 54
-1
votes
0 answers

How do I implement OptimisticLocking in Hibernate where the version is passed in as input

I want to do something like a two stage request similar to the ones found in Curam framework. What I was expecting was if I set the versionNo value and it's not the expected one, the JPA engine will throw an OptimisticLockException when I do…
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
-1
votes
1 answer

Optimistic and Pessimistic Locking in JPA vs Isolation level

Why do we need locking if we can easily change for instance isolation level from READ_COMMITED to REPEATABLE_READ or SERIALIZABLE. Do we win a lot of in perfomance? Should we up isolation level only and if only locking doesn't helps but actually I…
-1
votes
1 answer

Where/when to check the version of the row when doing optimistic locking?

I want to implement optimistic locking for a relational database. Suppose there is a users table id name version 1 Jhon 1 2 Jhane 1 My application fetches the Jhon user to change his name SELECT id, name, version FROM users WHERE id =…
Roman Mahotskyi
  • 4,576
  • 5
  • 35
  • 68
1 2 3
28
29