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 ...

learn more… | top users | synonyms

0
votes
0answers
16 views

optimistic locking in mongo_mapper rails

I'm a rails's developer, and need optimistic locking in mongo_mapper. I tried to install mm-optimistic_locking from ~ https://github.com/highgroove/mm-optimistic_locking, but got an error. My steps: ...
0
votes
1answer
24 views

How to catch OptimisticLockException in JPA

I've read out a couple of questions here regarding the OptimisticLockException with JPA, used in an stateless session bean. It is thrown, but not where I expect it obviously. Here is the code where I ...
0
votes
0answers
12 views

Optimistic record locking in CakePHP

I've started playing with CakePHP and I'm trying to set up some optimistic locking on records which I find isn't in the core. In the Apress book Practical CakePHP Projects there's an example that ...
2
votes
1answer
86 views

Is Optimistic-Locking absolutely safe?

when using optimistic-locking strategy, it can solve concurrency problem like below: | the first transaction started | | | | select a row ...
0
votes
1answer
59 views

How to use optimistic lock with hibernate when no fields changed

I'm using a optimistic strategy when updating entities by setting "<version />" element in hbm.xml s. It works fine when I update a single entity. But this strategy fails when dealing with this ...
0
votes
0answers
18 views

Difference between using update() and lock(x, READ) to reattach a versioned entity

I have a versioned entity that I want to re-attach to a new session and I am wondering what is the best method to use. The documentation says update() should be used, but also states You can also ...
0
votes
0answers
26 views

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 ...
0
votes
1answer
113 views

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 = ...
1
vote
2answers
113 views

JPA: OptimisticLockException and Cascading

In my current project I use Spring Data JPA with Hibernate but consider this as a more general question that should also cover "plain" JPA. I'm uncertain how I should deal with ...
0
votes
0answers
34 views

Rails optimistic locking update within a loop appears to work until I check from outside of the loop

I'm using optimistic locking on a Rails model. Inside of a loop, I update and save this model (or, rather, many instances of this model). From inside the loop, I output the "before" and "after" ...
0
votes
0answers
24 views

How can I implement optimistic locking using mongoengine?

I use mongoengine to access mongoDB, and I am looking for a simple way to implement an optimistic locking scheme. Ideally, I would like to have a version integer field in the document, and increment ...
0
votes
1answer
79 views

Hibernate/JPA lock OPTIMISTIC_FORCE_INCREMENT not working

I've got a problem setting the lock mode on an object. Here is the code : MyObject a = myQuery.getSingleResult(); logger.info(entityManager.getLockMode(a)); entityManager.lock(a, ...
0
votes
1answer
24 views

Should delete operations take into account optimistic locking?

In a REST API, the agent sends a DELETE request to /some-resource/666 Should that be enough? Or should they send the resource ID as well as the version (used for optimistic locking), so that they can ...
4
votes
1answer
161 views

Optimistic locking support in NSIncrementalStore subclass

I am implementing a custom NSIncrementalStore subclass which uses a relational database for persistent storage. One of the things that I still struggle with is the support for optimistic locking. ...
1
vote
3answers
107 views

Testing Optimistic Locking in Java EE environment

As I understand if a row in a database table is updated simultaneously by multiple threads the database would flag an error. In our production environment we have 2 Tomcat servers in a cluster. It ...
0
votes
1answer
150 views

Hibernate Optimistic Locking : Not getting any exception

I am trying to update the same row in different transaction to understand the optimistic locking of Hibernate. But I am not getting any StaleObjectStateException or any other exception. public void ...
1
vote
1answer
69 views

Some special case of Eclipselink JPA optimistic locking

I am starting with a JPA optimistic locking. I need to achieve the following scenario. User place some Request for consideration. This request has a status property. While being just put it has a ...
0
votes
1answer
73 views

JPA2.0: Semantic of OPTIMISTIC_FORCE_INCREMENT

I'm quite new to JPA and read this article about locking modes in JPA2.0, which left me with a question regarding the LockModeType.OPTIMISTIC_FORCE_INCREMENT. Here is an image with an example from ...
0
votes
0answers
162 views

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 ...
3
votes
3answers
163 views

Domain events and versioning without CQRS

Hi I have the following senario which I dont understand how to get eventual consistency with: User 1 uses Task based ui to change customer name App Service calls operation on the aggregate Aggregate ...
3
votes
3answers
103 views

PHP/MySQL/jQuery Pessimistic Locking of Record

I've been thinking about developing some simple record locking for an application I'm involved in. There are a few users who will take literally hours to complete an edit of a record. This causes ...
0
votes
1answer
125 views

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: ...
1
vote
2answers
112 views

How to efficiently lock a code block in order to avoid optimistic lock exception

I am not very experienced with Multithreading in Java. What I want is to set a lock for a code block. In my case i want to avoid optimistic lock exceptions, while doing some synchronization for a ...
4
votes
1answer
166 views

How do you implement a coarse-grained optimistic lock in REST?

I have implemented optimistic locking for my REST resources that have 1-to-1 mapping to database tables by passing back a version number which was in the GET back through to the PUT call. If the ...
1
vote
1answer
112 views

Ebean optimistic locking - version column vs all columns?

I see that Ebean supports both ways but what are the real world differences between using @version or all approach? Any reason not to use @version everywhere with Ebean? http://www.avaje.org/occ.html ...
2
votes
0answers
151 views

EntityManager throws OptimisticLockException when try to delete locked entity in same transaction

Here is my code: EntityManager em = JPAUtil.createEntityManager(); try { EntityTransaction tx = em.getTransaction(); try { //do some stuff here tx.begin(); ...
2
votes
1answer
177 views

EJB - Using an EntityManager - Can finding an entity cause an OptimisticLockException

Unfortunately I'm getting an OptimisticLockException in my code and I'm not sure why. Perhaps there is someone who can help me with an answer to a general question. Following scenario: @Entity ...
0
votes
1answer
103 views

Hibernate automatic versioning not working (with Spring)

I am trying to use the automatic versioning of Hibernate but when the update method f of the Session is called I do not see the version field in the where clause of the query nor is the version ...
0
votes
1answer
27 views

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 ...
2
votes
1answer
71 views

Table indexes/pk for Optimistic Locking in JPA

What is the best practice for defining table indexes for entities supporting optimistic locking? For sure, entity id has to be part of some index in DB to enable fast lookups by id. What about ...
2
votes
0answers
85 views

Weird transaction handling JavaEE 6

Currently I study the JavaEE 6 transaction handling and I'm a little bit stuck. I simulate a seminar booking engine where someone can book one or more persons on a seminar. My entity looks like this: ...
1
vote
2answers
120 views

How to catch OptimisticLockException in JavaEE 6?

I wonder what is the best way to catch an OptimisticLockException in JavaEE 6. I have the following EJB: @Stateless public class SeminarBooking { public void bookSeminar(Long seminarId, int ...
0
votes
2answers
390 views

Best practice Hibernate optimistic locking and web application

I have a web application made with Tapestry5 (java webframework) and Hibernate. Now I'm trying to add optimistic locking. So I added a version attribute and the optimistic locking works, so that was ...
0
votes
0answers
119 views

hibernate: optimistic concurrency control

I am trying to learn optimistic concurrency control. The following program opens a session, creates a row in table : id=1 name = "raj", commits and closes the session start a thread, that sleeps ...
0
votes
1answer
272 views

Hibernate's StaleObjectStateException still thrown after entity reloaded

I am playing with a standard optimistic concurrency control scenario with extended session / automatic versioning. I have an entity which I load in the first transaction, present to user for ...
1
vote
0answers
184 views

Spring HibernateTemplate HibernateOptimisticLockingFailureException in multithread

I have encounter a problem when I use the HibernateTemplate from Spring to access mysql database. It works ok in the single thread environment, but It always throw excpetion about the ...
2
votes
1answer
454 views

NHibernate could not synchronize database state with session

I was checking log files of NHibernate, and found out random errors, as below: NHibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was ...
0
votes
1answer
74 views

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 ...
1
vote
0answers
197 views

OptimisticLockException not thrown when version has changed

I've created a simple EJB application that uses JPA for persistence and have a problem whereby optimistic locking is not functioning as I would have expected. The application contains a class named ...
1
vote
1answer
124 views

Is it possible to implement field level optimistic concurrency using Entity Framework 4.1 (EF4.1)

All my applications use field level optimistic concurrency. This works by keeping track of the original database values and performing a 3 way compare between the original values, the updated values ...
0
votes
1answer
480 views

Recovering from hibernate optimistic locking exception

I have a method like this: @Transactional(propagation = Propagation.REQUIRES_NEW) public void doSomeWork(){ Entity = entity = dao.loadEntity(); // do some related work ... try { ...
0
votes
1answer
122 views

Is increment_counter indirectly manipulating lock_version?

Is increment_counter indirectly manipulating lock_version? I'm testing against concurrency, and I notice lock_version is incrementing. Even though, I am not rescuing from ...
3
votes
1answer
429 views

Hibernate - retrying failed update because of StaleObjectStateException still tries to save the stale instance

I am having trouble with hibernate and versioning. I am using Hibernate 3.6.7-Final. Here is a code snippet from my DAO class (it is called by Spring Beans that use the @Transactional annotations, so ...
1
vote
2answers
112 views

Does if-match HTTP header require two-phase commits?

I'm trying to design a RESTful web API, so I've been studying rfc2616. I like the idea of using ETags for optimistic concurrency and was trying to use it to make a safe way to add resources without ...
0
votes
1answer
214 views

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 ...
1
vote
0answers
194 views

How can I get optimistic concurrency with JPA annotation

I am using JPA 3, with annotation (no mapping file) and with provider org.hibernate.ejb.HibernatePersistence I need to have optimistic concurrency. 1)I tried to rely on the tag called , it did not ...
0
votes
0answers
316 views

Vector clock for distributed lock service

I've read about vector clock and I wonder: since it allows to detect causality violations in distributed system, is it possible to use it to build distributed optimistic lock service and will such ...
0
votes
0answers
114 views

Conflict of optimistic locking turned on and off in different classes

My whole project has lock_version turned off with 'ActiveRecord::Base.lock_optimistically = false'. And I would like to turn it on only for one or two classes which I tried by adding ...
1
vote
1answer
490 views

JPA - @Version - increase on read

I have implemented a simple entity ejb with a @version annotation. I expect that the version number will increase after each update of an entity. @Version public Integer getVersion() { return ...
1
vote
1answer
164 views

Ignore optimistic-locking

I've got the entity that contains @version field. Sometimes I need to update it in spite of optimistic locking exception. Can I turn it off somehow in that case? Or I should just reload entity and ...

1 2 3
15 30 50 per page