Questions tagged [transactions]

A set of interrelated operations that must all succeed in order for any of them to succeed. Failure of any operation results in a rollback of all operations in the transaction.

In computer science, transaction processing is information processing that is divided into individual, indivisible operations, called transactions. Each transaction must succeed or fail as a complete unit; it cannot remain in an intermediate state.

Transaction processing is designed to maintain a system's Integrity (typically a database or some modern filesystems) in a known, consistent state, by ensuring that interdependent operations on the system are either all completed successfully or all canceled successfully.

Since most, though not necessarily all, transaction processing today is interactive the term is often treated as synonymous with online transaction processing

14812 questions
638
votes
20 answers

SqlException from Entity Framework - New transaction is not allowed because there are other threads running in the session

I am currently getting this error: System.Data.SqlClient.SqlException: New transaction is not allowed because there are other threads running in the session. while running this code: public class ProductManager : IProductManager { #region…
Keith Barrows
  • 23,420
  • 26
  • 78
  • 127
549
votes
19 answers

Where does the @Transactional annotation belong?

Should you place the @Transactional in the DAO classes and/or their methods or is it better to annotate the Service classes which are calling using the DAO objects? Or does it make sense to annotate both "layers"?
Thomas Einwaller
  • 8,371
  • 4
  • 35
  • 51
351
votes
3 answers

Using Transactions or SaveChanges(false) and AcceptAllChanges()?

I have been investigating transactions and it appears that they take care of themselves in EF as long as I pass false to SaveChanges() and then call AcceptAllChanges() if there are no errors: SaveChanges(false); // ... AcceptAllChanges(); What if…
mark smith
  • 19,527
  • 44
  • 131
  • 185
300
votes
9 answers

PHP + MySQL transactions examples

I really haven't found normal example of PHP file where MySQL transactions are being used. Can you show me simple example of that? And one more question. I've already done a lot of programming and didn't use transactions. Can I put a PHP function…
good_evening
  • 19,773
  • 60
  • 178
  • 288
286
votes
7 answers

TransactionScope automatically escalating to MSDTC on some machines?

In our project we're using TransactionScope's to ensure our data access layer performs it's actions in a transaction. We're aiming to not require the MSDTC service to be enabled on our end-user's machines. Trouble is, on half of our developers…
Yoopergeek
  • 5,494
  • 3
  • 21
  • 29
281
votes
11 answers

How to debug Lock wait timeout exceeded on MySQL?

In my production error logs I occasionally see: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction I know which query is trying to access the database at that moment but is there a way to find out which…
Matt McCormick
  • 12,955
  • 21
  • 72
  • 80
255
votes
3 answers

Correct use of transactions in SQL Server

I have 2 commands and need both of them executed correctly or none of them executed. So I think I need a transaction, but I don't know how to use it correctly. What's the problem with the following script? BEGIN TRANSACTION [Tran1] INSERT INTO…
Saeid
  • 12,286
  • 26
  • 98
  • 166
220
votes
8 answers

Does Spring @Transactional attribute work on a private method?

If I have a @Transactional -annotation on a private method in a Spring bean, does the annotation have any effect? If the @Transactional annotation is on a public method, it works and open a transaction. public class Bean { public void doStuff() { …
Juha Syrjälä
  • 30,987
  • 31
  • 122
  • 175
212
votes
11 answers

Transactions across REST microservices?

Let's say we have a User, Wallet REST microservices and an API gateway that glues things together. When Bob registers on our website, our API gateway needs to create a user through the User microservice and a wallet through the Wallet microservice.…
Olivier Lalonde
  • 17,330
  • 28
  • 69
  • 86
212
votes
5 answers

SQL Server - transactions roll back on error?

We have client app that is running some SQL on a SQL Server 2005 such as the following: BEGIN TRAN; INSERT INTO myTable (myColumns ...) VALUES (myValues ...); INSERT INTO myTable (myColumns ...) VALUES (myValues ...); INSERT INTO myTable (myColumns…
jonathanpeppers
  • 24,837
  • 21
  • 94
  • 178
180
votes
9 answers

What is the difference between Non-Repeatable Read and Phantom Read?

What is the difference between non-repeatable read and phantom read? I have read the Isolation (database systems) article from Wikipedia, but I have a few doubts. In the below example, what will happen: the non-repeatable read and phantom…
177
votes
4 answers

javax.transaction.Transactional vs org.springframework.transaction.annotation.Transactional

I don't understand what is the actual difference between annotations javax.transaction.Transactional and org.springframework.transaction.annotation.Transactional? Is org.springframework.transaction.annotation.Transactional an extension of…
stamis
  • 1,885
  • 2
  • 12
  • 9
167
votes
3 answers

Is there an API to get bank transaction and bank balance?

I'm using CHASE bank. (Also Bank of America) and I want to get my bank transactions and my balance if I can. Is there an API for that? in PHP or JAVA? If so, please let me know how to get them.
Expert wanna be
  • 8,490
  • 21
  • 98
  • 148
167
votes
8 answers

How do ACID and database transactions work?

What is the relationship between ACID and database transaction? Does ACID give database transaction or is it the same thing? Could someone enlighten this topic.
never_had_a_name
  • 80,383
  • 96
  • 257
  • 374
145
votes
5 answers

Transactions in .net

What are the best practices to do transactions in C# .Net 2.0. What are the classes that should be used? What are the pitfalls to look out for etc. All that commit and rollback stuff. I'm just starting a project where I might need to do some…
Malik Daud Ahmad Khokhar
  • 12,720
  • 24
  • 75
  • 81
1
2 3
99 100