16,354 questions
-1
votes
0
answers
14
views
shared vs exclusive lock in sql for each isolation level
I am studying transaction in sql, i read about isolation levels. Got to know about shared lock(read lock) and exclusive lock(write lock).
As per multiple sources, exclusive lock can only be taken if ...
0
votes
0
answers
18
views
How to extract actual database error instead of the generic transaction aborted error in Postgresql Sequelize transaction
I am using transaction in my sequelize-typescript for creating a record which looks like this
return await this.sequelize.transaction(async (transaction) => {
const borrower = await this....
0
votes
0
answers
10
views
`TypeError` in Stellar SDK and Stellar wallet kit when using `signAndSend` with `signTransaction` implementation inconsistency across devices
I am working on a project that interacts with the Stellar blockchain, using the Stellar SDK and Stellar Wallet Kit to interact with smart contracts. I have a function that is supposed to create a ...
0
votes
0
answers
25
views
mysqli rollback commit is not working with innodb table [duplicate]
I am trying to set up transaction rollbacks but no matter what I do, the insert is not rolled back.
I have confirmed the DB engine is innoDB:
Name Engine Version ...
1
vote
1
answer
27
views
Data Logic at Facade level
I have 2 Db's with their own projects, data services and controllers.
We have methods for them at the facade level which can use either Db.
I have a situation where I need to write something to both ...
0
votes
0
answers
25
views
migrate legacy java system transaction into spring
I try to find the optimal solution for the following:
I have an old JAVA based monolit legacy system, which communicates with servlets.
I would like to migrate this using spring framework.
I have the ...
0
votes
1
answer
70
views
How to properly set the transaction locks [closed]
The documentation at MSDN for "Set Transaction Isolation Level" lists 4 different isolation levels.
I read through them, but I prefer to learn by example, so the explanation is not good for ...
-1
votes
0
answers
11
views
Data Replication across data center for banking transactions
Suppose I am developing a backend for Transaction management system. When a banking transaction happen which when mapped to Db transaction, does it include write logs to different geos. If it does not ...
0
votes
0
answers
43
views
spring boot testcontainers "row was updated or deleted by another transaction"
I want to make an entity testing with with PostgreSQL testcontainers in my SPring boot 3.x app. First I try to insert some constraint violation records and then some valid records and then I want to ...
1
vote
0
answers
16
views
How can I handle transactions across multiple containers in GridDB?
I am working on a project using GridDB and need to manage transactions across multiple containers. Specifically, I want to ensure that if one operation fails, all changes in the transaction are rolled ...
0
votes
0
answers
35
views
How to implement transaction for long running API including multiple document changes in Azure Cosmosdb Mongo Nodejs [closed]
I have multiple API which are interacting with Azure Cosmosdb, where multiple documents are being updated. Now I want to add transactions here.
But the limit of 5 seconds for a transaction is making ...
-1
votes
0
answers
36
views
Handling deadlock between two transactions
Using Postgres and Jooq to generate SQL queries
I have two transactions that can run parallelly, each has query
INSERT INTO <TABLE> ... ON CONFLICT(SESSION_ID, PARTITION_DATE) UPDATE SET ....
...
1
vote
1
answer
29
views
The right way to create safe transactions in MongoDB
I’m working on a Node.js application using Mongoose and MongoDB. In the following code, I’m using a transaction to handle creating a new topic with an automatically incremented position. My goal is to ...
0
votes
1
answer
39
views
How to batch transaction in Java Neo4J API using CALL { } IN TRANSACTIONS?
I am developing a Java application using Neo4j version 5.20.0 (implementation "org.neo4j:neo4j:5.20.0") and I want to save a list of Person objects in the database.
Currently, I have a ...
0
votes
0
answers
19
views
Spring/Hibernage shares the persistence context from before the transaction with the transaction
In the following example, when the POST /foo/test1 endpoint is called, the entity will be saved to the database. However, calling POST /foo/test2 will not trigger any updates.
@RestController
@...
1
vote
1
answer
38
views
JPA: Why isn't entity save() working inside catch block despite @Transactional?
I am currently working with JPA. I’ve encountered an issue during development. Here’s the current situation:
itemService addItem: If the item is already owned, an exception is thrown. If the item is ...
1
vote
1
answer
57
views
Spring Transaction Rollback
I have functions, and this functions will go on catch conditions.
My expectations whenever it goes to catch conditions it should've rollback the previous save data. but why the data is still saved on ...
0
votes
0
answers
7
views
Repeatable reads transaction level
-- TRANSACTION 1
set transaction isolation level REPEATABLE READ
BEGIN TRANSACTION
select name from student where id=1
waitfor delay '00:00:15'
update Student set name='abc' where id=1
commit ...
-1
votes
0
answers
16
views
Mongoose inconsistent stock issue in the transaction which occurs randomly
export const createBill = async (req, res) => {
const currentDate = getDate();
const products = req.body.purchased;
let {
customerId,
billId,
payment = 0,
paymentMode,
...
0
votes
0
answers
53
views
Cannot roll back a transaction with CREATE TABLE statement [duplicate]
func main() {
ctx, cancel := context.WithCancel(context.Background())
tx, err := db.BeginTx(ctx, nil)
if err != nil {
log.Fatal(err)
}
DoTx(tx, ctx, cancel)
}
func DoTx(...
-1
votes
0
answers
26
views
Handling backendless transaction results
I am creating a WPF application using C#, I am trying to get a list of objects from a backendless database using transaction, I don't know how to store them into a list.
List<JobCardSRF> list = ...
0
votes
0
answers
28
views
SQL Syntax Error in Transaction with IF Statement [duplicate]
I have this data:
CREATE TABLE cuentas (
id_cuenta INT PRIMARY KEY,
saldo DECIMAL(10, 2)
);
INSERT INTO cuentas (id_cuenta, saldo) VALUES (1, 1000.00);
INSERT INTO cuentas (id_cuenta, saldo) ...
1
vote
1
answer
34
views
Django atomic transaction unit test failing (commits not being rolled back)
I have a Django project with the following two models:
# models.py
from django.db import models, transaction
class Person(models.Model):
name = models.TextField()
surname = models....
2
votes
1
answer
90
views
Postgres / SQL pattern for atomic SELECT and UPDATE or INSERT within a transaction
I have a simple scenario, where I want to atomically read and modify the state of a row. But the row may not exist yet.
For this example, I use the user_group_membership table:
user_id (pk) | group_id ...
0
votes
0
answers
8
views
Is lost update possible with serializable transaction isolation?
It is often stated serializable transactions prevents all read phenomena including lost update and phantoms. But is this the case when read committed transaction (A) and serializable transaction (B) ...
2
votes
2
answers
85
views
Why does database not read from newly inserted data when a single query is doing both write and read?
DROP TABLE IF EXISTS A;
CREATE TABLE a (id int);
CREATE or replace FUNCTION insert_and_return(int)
RETURNS int AS $$
BEGIN
INSERT INTO a VALUES ($1);
RETURN $1;
END;
$$ ...
1
vote
1
answer
29
views
Handling race conditions between transactions
I am using postgres 14.2. I am using jooq and spring-boot in my service.
I have table user where I have a unique constraint on user_id, created_on, I have to update the value if the value of user_id, ...
0
votes
0
answers
24
views
pyodbc Transactions in Django View are Committing Changes Despite Rollback Attempts
I'm working on a Django application where I'm using pyodbc to connect to an AWS RDS SQL Server database. I need to run a series of raw SQL queries (including INSERT, UPDATE, DELETE, DISABLE or ENABLE ...
0
votes
1
answer
45
views
Why is there no SQL statement in MON$STATEMENTS.MON$SQL_TEXT for all active transactions in Firebird 2.5
I am trying to find the SQL statements for my active transactions and specifically for OAT.
I am running this query:
select MT.MON$TRANSACTION_ID,MT.MON$TIMESTAMP,MS.MON$STATEMENT_ID,MS.MON$SQL_TEXT
...
1
vote
0
answers
17
views
How to arrange Spring Batch chunk processing with online transactions
The system has simultaneous batch jobs and online workflows. Consider batch job retrieving unprocessed documents, marking them as processed in the chunk transaction. Chunk processing is required for ...
0
votes
1
answer
64
views
Google BigQuery InsertAll with Transaction?
I am new to BigQuery in general and I'm attempting to insert multiple rows into a bigquery table while also modifying another table in a single transaction.
I'm using the BigQuery java client in ...
1
vote
1
answer
50
views
Sequelize transactions are very slow
I'm using sequelize with node to make a simple update endpoint that will make a couple of queries:
const update = async (req: any, res: any, next: any) => {
const t = await db.sequelize....
1
vote
1
answer
32
views
When sanpshot is taken into consideration in transactions?
When is the snapshot actually taken in transactions? On BEGIN TRANSACTION or on the first operation?
I've been experimenting with transactions in both MySQL and PostgreSQL using the REPEATABLE READ ...
0
votes
0
answers
85
views
How to send jettons with tonconnectui
I’m new to blockchain programming and am working on creating a transaction using TonConnectUI in JavaScript. I’d like to send a transaction involving tokens that are not typical currency tokens—such ...
0
votes
0
answers
10
views
Spring MongoDB swallowed exception still causes transaction to roll back
I tried to use MongoTemplate to insert the same user object twice with userId being the _id, the second insert fails due to DuplicateKeyException which is expected, and then the DuplicateKeyException ...
0
votes
0
answers
74
views
Neo4j CALL {} IN TRANSACTIONS Does Not Work in Neo4j HTTP API
According to this https://neo4j.com/docs/http-api/current/transactions/, neo4j transactions cannot be used in explicit transactions and need to be sent as implicit transactions.
However, after ...
0
votes
0
answers
29
views
Can't load Hive transactional table into dataframe using Spark2
I'm trying to load a hive transactional table into a PySpark dataframe, but receive the error:
py4j.protocol.Py4JJavaError: An error occurred while calling o086.showString.
Caused by: java.util....
0
votes
0
answers
72
views
Failed capture of amounts in transaction table
I have not been able to extract all the information from a table of debit and credit transactions.
The following is the table:
I have used several approaches and ideas with regular expressions, but I ...
1
vote
1
answer
105
views
Atomikos library has incompatibility packages (from javax.transaction to jakarta.transaction)
I have Atomikos (6.0.0) in Spring Boot 3 and using Java 21. It's working but using a @Deprecated class, "ChainedTransactionManager(transactionManagerOne, transactionManagerTwo)". This way ...
0
votes
0
answers
37
views
Hibernate does not rollback super class entity tables
I have an inheritance of type JOINED between User and RegisteredUser.
I have defined a unique constraint on the derived class entity (RegisteredUser).
When I create an object of the derived class and ...
1
vote
0
answers
38
views
How to smoothly transition between absolute and fixed positions on a navbar during scroll?
I'm trying to implement a navbar that switches from position: absolute to position: fixed when the user scrolls down more than 160 pixels. My goal is to have a smooth transition between these two ...
0
votes
0
answers
30
views
Issue With HibernateTransactionManager while migrating Spring MVC applicaiton from spring 4.x/hiberate3.x/java1.8 to spring6.1/Hibernate5.x/Java17
I am migrating lagacy spring mvc application with spring4.x/hiberate3.x/java1.8 in tomcat8.5 server to spring6.1/Hiberate5.6.x/java17/tomcat10.1.3. as part of this process , I replaced JOTM ...
0
votes
0
answers
25
views
@Transactional propagation and isolation levels in Spring Boot
I have a question regarding @Transactional annotation.
In our project we have a REST controller that receives events from the message bus and calls a UseCase(@Service) to save the changes to the ...
2
votes
1
answer
59
views
Nested SQL transactions in Active Record - risks?
I am in a situation in which I am forced to use nested transactions:
I have several methods that save a bunch data, each of them needs to be wrapped in a SQL transaction, and they also have to call ...
0
votes
0
answers
35
views
How to achieve MySQL transaction with complicated computation? [duplicate]
For example, here's a table with 2 columns called USER_ID, MY_COLUMN. I want to change the MY_COLUMN for a single user specified by USER_ID.
If the modification is very naive/simple, say MY_COLUMN is ...
0
votes
3
answers
88
views
Circular dependency on TransactionManager Bean in Spring Batch
I'm working on a Spring Batch project and I have a StackOverflowError with this Bean.
@Bean
@Primary
public JtaTransactionManager transactionManager(UserTransaction userTransaction,
...
1
vote
0
answers
67
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 ...
0
votes
0
answers
56
views
Spring Boot Kafka Issue With Transactionality When Using ReplyingKafkaTemplate
I want to use ReplyingKafkaTemplate in order to implement Request-Reply messaging pattern with Kafka having end-to-end transactionality. I have tried many solutions and I concluded to the following ...
1
vote
0
answers
24
views
In Kotlin/Android, can I use withContext() and withTransaction together?
The situation is that I have to combine networkcalls and database executions in a single method, as in this pseudocode:
do {
fetchPagedDataFromNetwork
insertDataIntoDatabase
} while not last ...
0
votes
0
answers
32
views
Understanding Optimistic vs Pessimistic Concurrency Control in Real-World Use Cases
I'm having trouble understanding the difference between optimistic and pessimistic concurrency control when applied to real-world scenarios. Let's consider this example:
Scenario 1: Updating order ...