transactions

spring, hibernate and declarative transaction implementation: there is no active transaction

岁酱吖の 提交于 2019-12-17 18:03:13
问题 i try to make declarative transaction work. This is my spring.xml file: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation= "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework

MySQL Auto Increment Columns on TRANSACTION, COMMIT, and ROLLBACK

狂风中的少年 提交于 2019-12-17 16:45:12
问题 When using MySQL START TRANSACTION and the decision is made by MySQL to roll back - In the case that a table had an AUTO_INCREMENT column - does the column get... decremented during the roll back? Or should it? I am having some issues where the transaction data is being properly rolled back - but it looks like the table was auto incremented and not decremented in the rollback. # BOTH TABLES START OUT EMPTY // TABLE1 ID is **auto_increment** START TRANSACTION; INSERT INTO `TABLE1` (`ID` ,`NAME

How to rollback a transaction in Entity Framework

社会主义新天地 提交于 2019-12-17 16:28:32
问题 string[] usersToAdd = new string[] { "asd", "asdert", "gasdff6" }; using (Entities context = new Entities()) { foreach (string user in usersToAdd) { context.AddToUsers(new User { Name = user }); } try { context.SaveChanges(); //Exception thrown: user 'gasdff6' already exist. } catch (Exception e) { //Roll back all changes including the two previous users. } Or maybe this is done automatically, meaning that if error occurs, committing changes are canceled for all the changes. is it? 回答1: OK I

Do stored procedures run in database transaction in Postgres?

好久不见. 提交于 2019-12-17 16:28:24
问题 If a stored procedure fails in middle, are changes at that point from the beginning of SP rolled back implicitly or do we have to write any explicit code to make sure that SP runs in a database transaction only? 回答1: Strictly speaking, Postgres did not have stored procedures as defined in the ISO/IEC standard before version 11. The term is often used incorrectly to refer to functions , which provide much of the same functionality (and more) as other RDBMS provide with "stored procedures". The

Do DDL statements always give you an implicit commit, or can you get an implicit rollback?

白昼怎懂夜的黑 提交于 2019-12-17 15:56:13
问题 If you're halfway through a transaction and perform a DDL statement, such as truncating a table, then the transaction commits. I was wondering whether this was always the case and by definition, or is there a setting hidden somewhere that would rollback the transaction instead of committing. Thanks. Edit to clarify... I'm not looking to rollback after a truncate. I just want to confirm that statements already carried out are absolutely always going to be committed before a DDL. Just want to

PHP prepared statements and transactions in a loop

邮差的信 提交于 2019-12-17 15:46:12
问题 The classic transactions in a loop code: $mysqli->query("START TRANSACTION"); foreach ($pdata as $key => $value) { $sql = "INSERT INTO temp (`fund_id`) VALUES (" . $value . ")"; $result = $mysqli->query($sql); } $mysqli->query("COMMIT"); Then we change to prepared statements: $mysqli->autocommit(FALSE); foreach ($pdata as $key => $value) { $sql = "INSERT INTO temp (`fund_id`) VALUES (?)"; $stmt = $mysqli->prepare($sql); $stmt->bind_param('i', $value); $stmt->execute(); } $mysqli->commit();

MySQL rollback on transaction with lost/disconnected connection

匆匆过客 提交于 2019-12-17 15:32:01
问题 I need to make MySQL server to rollback transaction immediately after its client disconnected, because each client works concurrently. The problem can be reproduced like these (using an innodb table type) On Client A: START TRANSACTION; SELECT MAX(ID) FROM tblone FOR UPDATE; #... then disconnect your connection to the server On Client B: START TRANSACTION; SELECT MAX(ID) FROM tblone FOR UPDATE; #... lock wait time out will occur here I had set MySQL's server option like innodb_rollback_on

Atomikos vs JOTM vs Bitronix vs? [closed]

北战南征 提交于 2019-12-17 15:27:33
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I am new to JTA and it's underlying transaction managers. Can anyone explain the pros/cons of each of these? Feel free to add others I didn't list in title. Also, don't the major applications servers (WebSphere, JBoss, Glassfish) have their own JTA compliant transaction

MySQL 'select for update' behaviour

最后都变了- 提交于 2019-12-17 10:44:39
问题 As per the MySql documentation, MySql supports Multiple granularity locking(MGL). case-1 Opened terminal-1: // connected to mysql mysql> start transaction; Query OK, 0 rows affected (0.00 sec) mysql> select id, status from tracking_number limit 5 for update; +----+--------+ | id | status | +----+--------+ | 1 | 0 | | 2 | 0 | | 3 | 0 | | 4 | 0 | | 5 | 0 | +----+--------+ 5 rows in set (0.00 sec) mysql> left it opened and opened terminal-2: // connected to mysql mysql> start transaction; Query

“The operation is not valid for the state of the transaction” error and transaction scope

别说谁变了你拦得住时间么 提交于 2019-12-17 10:34:21
问题 I am getting the following error when I try to call a stored procedure that contains a SELECT Statement: The operation is not valid for the state of the transaction Here is the structure of my calls: public void MyAddUpdateMethod() { using (TransactionScope Scope = new TransactionScope(TransactionScopeOption.RequiresNew)) { using(SQLServer Sql = new SQLServer(this.m_connstring)) { //do my first add update statement //do my call to the select statement sp bool DoesRecordExist = this