transactions

AOP, Spring and transaction scoping

风流意气都作罢 提交于 2019-12-22 09:11:27
问题 imagine a transactional, multithreaded java application using spring, jdbc and aop with n classes in m packages all taking part in database transations. Now let's say there is the need to scope an arbitrary set of classes within one transaction. Furthermore there is always one class T within the scope that commits the transaction when called. Let me give an example for clarity: Given the packages A,B,Z and classes A.Foo, B.Bar and Z.T. The following instances of the respective classes are

How to debug CMT transaction boundaries?

蓝咒 提交于 2019-12-22 08:49:22
问题 I have been studying jboss CMT , and would like to learn how the transaction works from top to bottom, best way would be printing debug information to the log file, I enabled org.hibernate.SQL , however, i am only getting SQL statement , there is no "begin" nor commit type of the transaction related statement in log, remains the same when debuging from org.hibernate.* level. Did a little googling, answer seems tweaking jbosstx-properties.xml, tried that, didn't help either. Can anybody help

How to set “SET XACT_ABORT ON ” in a SQL Server transaction?

我们两清 提交于 2019-12-22 08:47:28
问题 I want to set SET XACT_ABORT ON in a SQL Server 2008R2 stored procedure with a transaction, so do it in a creation script: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET XACT_ABORT ON GO CREATE PROCEDURE MyProc AS BEGIN TRAN ... IF @@ERROR <> 0 BEGIN GOTO Done END ... IF @@ERROR <> 0 BEGIN GOTO Done END COMMIT TRAN Done: IF @@ERROR <> 0 BEGIN ROLLBACK TRAN END GO After successful creation, I check the transaction by clicking "Modify" stored procedure option and in a generated ALTER

DTC firewall requirements?

有些话、适合烂在心里 提交于 2019-12-22 08:45:03
问题 I'm attempting to set up an environment in which a TransactionScope originating on a web server (asp.net) will flow a transaction through WCF to an application server and subsequently through to the database. Since I'm forced to use a SQL Server 2005 database, this often causes the transaction to be 'promoted' to a distributed transaction (several service calls could be wrapped in this TransactionScope), which means the Distributed Transaction Coordinator needs to be enabled. I've

How to wrap IDbTransactions in a TransactionScope

佐手、 提交于 2019-12-22 08:21:30
问题 I have several code methods that look like this: using (var connection = this.connectionFactory.GetConnection()) { connection.Open(); using (var transaction = connection.BeginTransaction()) { using (var command = connection.CreateCommand()) { command.Transaction = transaction; command.CommandText = "foo"; command.ExecuteNonQuery(); transaction.Commit(); } } } I now need to call several of these methods together inside an outer transaction, So I did this: using (var transactionScope = new

Can I use transaction like capability in MySQL trigger

五迷三道 提交于 2019-12-22 07:44:07
问题 I have an insert trigger which takes a set of column values from rows in table A and inserts some of them in table B and remaining in table C. I need this operation to be a transaction wherein if there is some error whilst data is inserted in table B and not C, the entire insertion operation should be rolled back. I studied the manual and it says at the last of this page that transaction is not allowed in triggers Is there a way to achieve what I want in mysql. 回答1: Yes you can, but how you

Does Spring close connection after committing transaction?

為{幸葍}努か 提交于 2019-12-22 07:20:13
问题 I've recently read in one tutorial that Spring closes connection after transaction commit. Is that true? I can't find anything about it in the Spring reference documentation. What's the rationale behind it? Since now, I thought that there is a one-to-many relation between connection and transactions. 回答1: Spring calls close() when the transaction finishes which could be from either a commit or rollback. Whether or not close() actually closes a real JDBC connection depends on the DataSource

Is Exception handling required in Spring Transaction?

和自甴很熟 提交于 2019-12-22 06:53:42
问题 I am having a doubt in exception handling with a Transaction. To state clearly my problem I would like to show my configuration: <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <bean id="transactionInterceptor" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

How to set the timeout on a NHibernate transaction

孤街醉人 提交于 2019-12-22 06:48:32
问题 I need a lot of DB processing done in a single transaction, including some processing using NHibernate. To make everything work in the same transaction, I'm using NHibernate's Session to start it, and enlist the the commands for the other work in it. Everything goes OK until I commit. At that time I get a transaction timeout. How can I set the NHibernate transaction timeout value sufficiently high? We use FluentNHibernate. 回答1: After some trial and lots of error I found this: It appears that

Where should I perform action when implementing IEnlistmentNotification?

有些话、适合烂在心里 提交于 2019-12-22 06:20:48
问题 I am trying to create a custom "resource manager" by implementing IEnlistmentNotification interface. This interface has following methods: Prepare() Commit() Rollback() InDoubt() While it's clear that rollback code should go in Rollback() method I am not sure in which method should I implement the code that performs the actual operation? Should it go in Prepare() or Commit() or maybe some other custom method in the class that will be called from outer code from inside of TransactionScope