Questions tagged [pessimistic-locking]

Pessimistic locking is a strategy that will lock a database record, that is to be updated, for exclusive use until the update is complete.

Pessimistic locking is a strategy that will lock a database record, that is to be updated, for exclusive use until the update is complete. The database record is locked immediately when the lock is requested and it is then guaranteed that the database record will be updated. Unlike optimistic locking, great care must be taken in the application design to avoid deadlocks.

178 questions
0
votes
0 answers

how to pessimistic locking in yii framework?

how to pessimistic locking in yii? I searched in google, not saw any post about "how to pessimistic locking in yii". So I ask every one, who known, can show me.
MrTo-Kane
  • 510
  • 5
  • 15
0
votes
0 answers

Where adding pessimistic lock in using hasMany?

Suppose I have this code Domain class Parent{ static hasMany = [Childs:Child] } class Child { String name } Controller def ParentInstance = Parent.get(1) //Parent.lock(1) ParentInstance.Childs.each { //it.lock() it.name =…
Jils
  • 783
  • 5
  • 12
  • 32
0
votes
0 answers

grails/hibernate - use lock with getAll() method

As documented we could use obtain pessimistic lock like this: def airport = Airport.get(10, [lock:true) airport.lock() // lock for update airport.name = "Heathrow" airport.save() I tried to de the same think with getAll but it doesn't work def…
Jils
  • 783
  • 5
  • 12
  • 32
0
votes
1 answer

java.lang.NoSuchFieldError: PESSIMISTIC_WRITE error with jpaConsumer in apache camel

I am getting the below error with PESSIMISTIC_WRITE while using same jpa component in 2 routes although camel jpa is by default PESSIMISTIC_WRITE from 2.13.0 which I am using Error: [ERROR] ************************************* [ERROR] Error…
dreambigcoder
  • 1,859
  • 4
  • 22
  • 32
0
votes
1 answer

Locking an entity

I currently facing a problem with locking an entity in JPA. I have a list of several entities from a database. For each element there's a edit button which loads a view for editing that entry. Every time a client tries to edit an entry, I want to…
Thomas Schmidt
  • 1,248
  • 2
  • 12
  • 37
0
votes
1 answer

pessimistic locking in GORM where query

I'd like to achieve pessimistic lock with GORM's where query. Something like def query = Person.where { firstName == "Bart" } //instead of where.findAll() List personsLocked = where.lockAll() I know, I can achieve that by criteria API: List…
Tomas Bartalos
  • 1,256
  • 12
  • 29
0
votes
0 answers

Translate Native Query to Hibernate Query

I have following method to extract data from DB table public User getNextUser() { final EntityManager em = getEntityManagerFactory().createEntityManager(); final String sql = "UPDATE user " + "SET…
Luigi Saggese
  • 5,299
  • 3
  • 43
  • 94
0
votes
2 answers

pessimistic locking with prepared statment hibernate

I have a batch processing system that aggregates the success counts. Many servers does the aggregation, all updating a single row in a table concurrently. I executing prepared statements using hibernate like this SQL_UPDATE = "UPDATE STATS.COUNTS…
zolo
  • 149
  • 2
  • 10
0
votes
1 answer

Lightswitch 2011 Concurrency Control

I 've got two question. Does Lightswitch 2011 support also pessimistic concurency control? If so, how? Does optimistic control support ROWVERSION column on table from external data source or use only state of row (using original values)? Thank you…
polach.o
  • 652
  • 8
  • 16
0
votes
1 answer

Java EE 6 - Pessimistic Locking - ViewScoped bean + Stateful bean with UserTransaction, PreDestroy and other problems

In application I'm working on we need to start transaction before user enters 'edit page' (to lock DB records currently edited) and end it when he clicks the button or left the page. For this purpose I use @Stateful EJB bean which manages the…
0
votes
2 answers

Pessimistic locking of record?

I am creating a WCF Web Service, for a Silverlight application, and I need to have a record to be Read/Write Locked when Modified. I am using MySQL version 5.5.11. To be more specific, i would like to prevent a request from reading data from a Row…
SlashJ
  • 687
  • 1
  • 11
  • 31
-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

Pessimistic Write Locking not working in Hibernate

Am a newbie to hibernate. I have two transactions that work on the same record of the db Transaction 1 : reads the entity E. Applies Lock getCurrentSession().buildLockRequest( new LockOptions( …
1 2 3
11
12