transactions

The type or namespace name 'Transactions' does not exist in the namespace 'System' [duplicate]

时间秒杀一切 提交于 2019-12-23 07:26:38
问题 This question already has answers here : Visual Studio 2012 - Can't find System.Transactions assembly in .NET 4.5 framework (2 answers) Closed 3 years ago . This is in an ASP.Net web application, with Visual Studio 2013. The solution is composed of several projects. I have code in a library project that has using System.Transactions , and it's worked well for months. Today I added the same using System.Transactions in code in the web application project, and it fails with the error message

TransactionScope not rolling back transaction

亡梦爱人 提交于 2019-12-23 07:03:11
问题 Here is the current architecture of my transaction scope source code. The third insert throws an .NET exception (Not a SQL Exception) and it is not rolling back the two previous insert statements. What I am doing wrong? EDIT: I removed the try/catch from insert2 and insert3. I also removed the exception handling utility from the insert1 try/catch and put "throw ex". It still does not rollback the transaction. EDIT 2: I added the try/catch back on the Insert3 method and just put a "throw" in

how to atomically claim a row or resource using UPDATE in mysql

此生再无相见时 提交于 2019-12-23 06:57:17
问题 i have a table of resources (lets say cars) which i want to claim atomically. I then want information about which resource I just claimed. If there's a limit of one resource per one user, i can do the following trick: UPDATE cars SET user = 'bob' WHERE user IS NULL LIMIT 1 SELECT * FROM cars WHERE user = 'bob' This way, I claim the resource atomically and then I can see which row I just claimed. This doesn't work when 'bob' can claim multiple cars. I realize I can get a list of cars already

SeamPhaseListener - Could not start transaction - Seam 2.3, JSF 2 Tomcat 7, WAR

早过忘川 提交于 2019-12-23 06:05:06
问题 [EDIT] The working project can be found at: https://github.com/joergi77/JSF2_Richfaces4_Seam_23 [/EDIT] I migrated our old project to a newer setup. Old setup Seam 2.2.2.Final JSF 1.2 Richfaces 3.3.3.Final JBoss 5.1 GA EAR EJB Java EE5 New setup: Seam 2.3.1.Final JSF 2.1.2 Richfaces 3.3.3.Final (should be compatible to JSF 2) Tomcat 7.0.57 WAR NO EJB Java 7 The WAR file was already deployable and working with SEAM 2.2 and JSF 1.2. on the Tomcat 7.0.57 After that I was upgrading to SEAM 2.3

SQLAlchemy session: how to keep it alive?

谁说胖子不能爱 提交于 2019-12-23 06:01:08
问题 I have a session object that gets passed around a whole lot and at some point the following lines of code are called (this is unavoidable): import transaction transaction.commit() This renders the session unusable (by closing it I think). My question is two part: How do I check if a session is still alive and well? Is there a quick way to revitalize a dead session? For 2: The only way I currently know is to use sqlalchemy.orm.scoped_session, then call query(...)get(id) many times to recreate

how to commit a transaction in EJB?

余生颓废 提交于 2019-12-23 05:47:11
问题 I have the following scenario, public void someEjbMethod1() { for (int i=0; i=10; i++) { em.merge(arr[i]); em.flush(); } } I need to merge each object of ( arr[i] ) separately. as the above code will commit all the arr[i] instances at the end of the function. I am thinking to do the following: public void someEjbMethod1() { for (int i=0; i=10; i++) { saveObj(arr[i]); } } // should I use a transaction attribute here?? public void saveObj(SomeObject obj) { em.merge(arr[i]); em.flush(); } 回答1:

Spring @Transactional wont rollback after putting aspect around method

冷暖自知 提交于 2019-12-23 05:37:07
问题 I have two transactional methods one inside other. When around aspect is not set around methodA Transactional anotation work well. After calling methodA we call methodB, methodB write something in DB, then we return in methodA, throw an exception and then methodB roolback. But when I put my aspect around methodA, methodB wont rollback. I cant figure out what is happening there. I tried many combination of propagation attributes but none seems to work. Thanks in advance. I use Spring 2.5.4 I

my transaction is not rollback when something goes wrong in C# with mysql?

↘锁芯ラ 提交于 2019-12-23 05:29:16
问题 I am connecting mysql 5.1 from C# by using mysql connector6.2.3.0(.net).I want to insert 3 tables at a time.So, i am using transaction for that.Suppose, when some errors encountered while inserting data into my 3rd table, then the transaction is not rollback.The data is inserted into first two tables. This is my code... MySqlDataAdapter da = new MySqlDataAdapter(); DBUtil cUtil = new DBUtil(); MySqlConnection mysqlCon=null; MySqlTransaction txn = null; try { mysqlCon = cUtil.getDbConnection()

Nhibernate transaction locks a tabel

白昼怎懂夜的黑 提交于 2019-12-23 05:27:49
问题 I have developed a WCF api which is using nHibernate. I am new to this. I have used session.update to take care of transaction. I have a for loop in which based on select condition I am updating a record ie. If A is present in tabel1 then I am updating the table else inserting a new entry. I am getting "could not execute query." when trying to execute a select query on a table which was previously being updated by adding a new entry in the table. What I think is, because I am using session

How can I make a row being read wait until a lock on it is released using JDBC and MySQL?

醉酒当歌 提交于 2019-12-23 05:07:26
问题 So I have this small example.. import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import static java.sql.DriverManager.getConnection; public class Bar { public static void main(String[] args) throws SQLException, InterruptedException { final long start = System.currentTimeMillis(); final Connection connection = getConnection("jdbc:mysql://localhost:3306/sakila", "root", "root"); final Statement statement = connection.createStatement(); statement.executeUpdate