transactions

ISOLATION levels in Transaction

↘锁芯ラ 提交于 2020-01-14 06:32:10
问题 I want to know that what is the best way to arrive at the isolation level of the transaction? This is a good link of the available ISOLATION levels. Blockquote It will be nice if someone can explain the various isolation levels of a transaction 回答1: Update: Clarified and corrected explanation. Isolation levels just indicate how much of your transaction is affected by other concurrent transactions. The higher the isolation level, the less affected it is. The effort will be made manifest in cpu

Intercepting @Transactional After Optimistic Lock for Asynchronous Calls in Restful App

一世执手 提交于 2020-01-14 06:22:08
问题 The question I have today is how to retry a method after the @Transactional annotation causes an Optimistic Lock Exception (OLE) and rolls back the transaction. I have asynchronous calls to a Restful application that are attempting to update a database object based on some business logic. If I get an OLE, I'd like to retry the transaction after a delay of 0.2-0.5 seconds. @Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = false) public Response

Transaction on two tables at the same time in two different databases

旧巷老猫 提交于 2020-01-14 05:57:08
问题 I have spring-boot app with mybatis as my ORM. I also use sqlserver 2012 . I consider following scenario: void foo () { set current datasource as Datasource D1 (connected to database D1) do some insert on table T1 in database D1 set current datasource as Datasource D2 (connected to database D2) do some insert on table T1 (the same name) in database D2 } I would like to be able to ensure that it always succees both queries. Otherwise (when at least one of them fails) transaction will be

NamingException: jta.UserTransaction

梦想与她 提交于 2020-01-14 02:55:10
问题 I have a hibernate application which directly uses Java Transaction API resources. I'm trying to use UserTransaction to accomplish some basic database transactions The UserTransaction interface defines the methods that allow an application to explicitly manage transaction boundaries In hibernate.cfg.xml file I have the following properties: <session-factory> <property name="show_sql">true</property> <property name="connection.datasource">java:comp/env/myDataSource</property> <property name=

Spring TaskExecutor Transaction Lost (Proxy vs. Direct call)

做~自己de王妃 提交于 2020-01-14 02:52:06
问题 I try to get the TaskExecutor (ThreadPoolTaskExecutor) to work for a currently well working service with Transactions but when i start the Task the existing Transaction is not found anymore. (When below start() Method is called there is already a transaction active) (The SimplePOJO ist out of context and just holds some data lets say to be stored in the DB) @Component @Transactional(rollbackFor = { Exception.class }) public class MyService { @Autowired MyTaskRunner myTaskRunner; public void

Is unit of work a good pattern for transactions that will auto generate new objects (auto_increment id)?

拥有回忆 提交于 2020-01-14 00:33:50
问题 From the unit of work pattern i uderstand a method of doing typic transactions based on some domain repostiries (using a repository per domain object) . Example : after defining some repository objects in the UoW object , commit those repositories based on theyr state . Also the repositories should not contain any transaction logic . What happens when an insert() leads to a creation of a new object (auto generated id) that later on is needed by another object in the same transaction ? Unit of

Hierarchy of TransactionScope

旧城冷巷雨未停 提交于 2020-01-13 16:44:12
问题 Is it possible to have a hierarchy of transaction scopes? If the outer transaction scope does a dispose, what will happen to changes made in the inner transaction scope? My particular problem is that I have test code that runs code that has a transaction scope. When I call a second set of code with a transaction scope I get "Cannot access a disposed object. Transaction". Could it be that the dispose of the inner transaction scope is also disposing the outer transaction scope. 回答1: I doubt

Is it okay if from within one stored procedure I call another one that sets a lower transaction isolation level?

巧了我就是萌 提交于 2020-01-13 16:18:09
问题 I have a bunch of utility procedures that just check for some conditions in the database and return a flag result. These procedures are run with READ UNCOMMITTED isolation level, equivalent to WITH NOLOCK. I also have more complex procedures that are run with SERIALIZABLE isolation level. They also happen to have these same kind of checks in them. So I decided to call these check procedures from within those complex procedures instead of replicating the check code. Basically it looks like

MS Access (Jet) transactions, workspaces

假装没事ソ 提交于 2020-01-13 11:58:19
问题 I am having trouble with committing a transaction (using Access 2003 DAO). It's acting as if I never had called BeginTrans -- I get error 3034 on CommitTrans, "You tried to commit or rollback a transaction without first beginning a transaction" ; and the changes are written to the database (presumably because they were never wrapped in a transaction). However, BeginTrans is run, if you step through it. I am running it within the Access environment using the DBEngine(0) workspace. The tables I

How to specify default transaction isolation level in Grails

扶醉桌前 提交于 2020-01-13 10:16:09
问题 I cannot figure out how to specify default transaction isolation level in Grails application . Please help and point where my mistake is. Following are the details. Grails: 1.3.7 Database: Sql Server 2008. DataSource.groovy: dataSource { ... driverClassName = "net.sourceforge.jtds.jdbc.Driver" dialect = org.hibernate.dialect.SQLServerDialect defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_UNCOMMITTED } hibernate { ... connection.isolation = java.sql.Connection.TRANSACTION