440 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
253
views
How to correctly handle optimistic locking with Spring Data JPA and REST API
I am using Spring Boot 3.5 and have added an @Version field to my entity. This all works fine, but I wonder how I need to handle concurrent updates coming from the REST API.
Suppose 2 users have my ...
0
votes
0
answers
30
views
what are the usage differences between optimistic locking and Isolation levels?
optimistic lock and isolation levels have the same concepts in integrity of transactions. my question is when i should use different isolation levels instead of optimistic locking for achieving ...
2
votes
1
answer
147
views
JPA Optimistic lock for associations
I'm trying to solve a problem with optimistic locks in jpa and hibernate for parent entity with associations. I need to increment the version of parent when child entity is changed or a new child ...
1
vote
0
answers
100
views
Hibernate 6 Migration: OptimisticLockException and TransientObjectException When Copying Entities Between Two SQLite Databases
Use Case
Users can copy a subset of entities and their object graphs from a main SQLite database to an archive SQLite database, preserving IDs and relationships (1-to-1 copy). After migrating from ...
0
votes
0
answers
124
views
Redis Lettuce Optimistic Locking in Java Reactive
I'm trying to implement Optimistic Locking with Redis Lettuce client in Java Reactive according to this article: https://github.com/redis/lettuce/wiki/Reactive-API#other-examples.
I got 2 approaches, ...
0
votes
0
answers
36
views
Jakarta @Version sql update version error
All entity with @version
During saving, have next error
could not execute statement [Not found 3 param.] [update cons_data.e_fin_form set version=? where id=? and report_type=? and version=?]; SQL [...
6
votes
1
answer
4k
views
Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect):
I'm working on a Spring Boot application where I create an order using a createOrder method. Everytime, I encounter the following error:
OrderService
public class OrderService {
OrderRepository ...
-1
votes
1
answer
299
views
org.hibernate.StaleObjectStateException : Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
Gone through all the code bit by bit but just can't find what is wrong, if I make postman getUsers request it works fine, but when I make the POST request I get the error:
ERROR 7388 --- [...
1
vote
0
answers
55
views
concurrency in spring jpa with postgres
I am using jpa in my spring boot application (postgres) and have some entity called car. In the beginning cars are created without assignedUser field in database.
Then trough certain process (post ...
1
vote
0
answers
93
views
Why does this optimistic lock fails?
I was experimenting with optimistic locks and wrote this for hset, under heavy load of events trying to update the same key, observed TxFailedErr(redis: transaction failed) from redis client which is ...
2
votes
4
answers
528
views
Hibernate With Only Optimistic Locking Still Generates Deadlocks
We have a business application which uses Spring Boot, Hibernate, and an underlying Oracle Database (H2 database for tests).
Users make a lot of simultaneous requests to it.
To cope with the many ...
-2
votes
1
answer
112
views
In SQL, is it possible/safe to implement optimistic locking using a boolean instead of version increments?
I am trying to implement a simple mutex lock in SQL. My tentative solution is the following:
query = 'UPDATE my_table SET lock_field = 1 WHERE lock_field = 0 AND mutex_id = 17'
if (query.execute() == ...
1
vote
0
answers
50
views
How to setup optimistic locking for overlapping datetime?
I am trying to make a booking system, where users can book a booking at a location for a certain time period. The problem I am having is, 2 entries that happen at the same time and overlap in the time ...
0
votes
1
answer
19
views
JPA repository OptimisticLockingException not thrown
I wrote a JPA repository and a entity with version field to support optimistic locking.
@Version
var version: Long? = null
I wrote a test, which simulates concurrent update and delete and ...
0
votes
1
answer
66
views
Handling a specific scenario with a Test to verify that it's correctly implemented the Optimistic Lock
I'm tryng to get more into Optimistic Lock and in detail, verifyng with a test, that my implementation it's correct. The implementation it's with Java 11, SpringBoot and Maven interacting with a ...