transactions

Why is @Transactional(Propagation.NOT_SUPPORTED) not working as expected?

ⅰ亾dé卋堺 提交于 2019-12-25 12:30:11
问题 Given the following: An integration test is started using @Transactional(Propagation.REQUIRED) at class level. Some reference data is inserted with Propagation.NOT_SUPPORTED specified at method level. A service method marked as @Transactional(Propagation.REQUIRED) attempts to look up some reference data inserted in step 2. The service method can't see the reference data! My understanding was that if data is inserted outside the transaction, it would be instantly accessible to another method

Spring.NET with NHibernate and quartz transaction (global transaction manager)

家住魔仙堡 提交于 2019-12-25 12:13:46
问题 I want to use Global transaction manager at my service layer. eg. namespace AssemblyName.Core.Service.Implementation { public class DemoService { public void demo() { save(model); //This is nHibernate transaction SchedulerManager.GetInstance.save(id); //This is related to quartz. } } } What should I use? If I used TransactionScope() then it is giving me error as NHibernateTransaction can't be committed. I have used <object id="transactionManager" type="Spring.Data.NHibernate

limit field's value with value from another table before write

与世无争的帅哥 提交于 2019-12-25 09:35:03
问题 Are Postgres TRIGGER s transactional by default like (I've read) in MySQL? I've created a TRIGGER procedure that uses a simple IF to limit a column's value with a value from another TABLE with a subsequent UPDATE if the limit is breached. I'd prefer that to be in one single TRANSACTION , but if I wrap the IF ... THEN UPDATE with BEGIN ... COMMIT , it gives error SQL error: ERROR: syntax error at or near ";" LINE 2: BEGIN; ^ Are TRIGGER s TRANSACTION al by default? If not, how can a TRIGGER be

SQL statements to ROLLBACK but Audit inserts to COMMIT

故事扮演 提交于 2019-12-25 09:25:53
问题 SQL Server 2012 I have a Master stored proc, which calls several other 'child' stored procs. The master proc encapsulates the child procs in a transaction. Throughout the master and child procs, there are many inserts into an audit table. If the process succeeds, I get a detaied chain of events. If the process fails and rolls back, I would like to have a record of the last child proc processed in the Audit table, but the whole thing is rolled back, including the audit data. Is there a way to

How to use transactions on remote OrientDB

只谈情不闲聊 提交于 2019-12-25 09:16:57
问题 TL;DR How do I make SQL commands execute in a transaction when using a remote OrientDB database from a java server? Long version I have a remote OrientDB database that I connect to from a java server. I read in the OrientDB documentation that to start a transaction I call db.begin() and after the database updates I call db.commit() or db.rollback() . So this is initially what I was trying to do: try { db.begin(); db.command(new OCommandSQL('delete edge connected from #10:1')).execute(); db

What is the behavior of Coldfusion cftransaction tag when multiple databases are accessed?

强颜欢笑 提交于 2019-12-25 09:04:24
问题 The coldfusion documentation, (I'm using CF8) states: Changes to data that is requested by the queries are not committed to the datasource until all actions within the transaction block have executed successfully. But it also states: In a transaction block, you can write queries to more than one database, but you must commit or roll back a transaction to one database before writing a query to another I have multiple transactions in my code base which access 2 databases for both selects and

Transaction not working with activemq + spring-integration + spring-jms

限于喜欢 提交于 2019-12-25 08:57:08
问题 My queue is not getting transacted. I want to that my message should again go in queue if any error occurs but message does not get transacted ( or does not again goes to the queue) Below is my camel configuration file <bean id="txManager" class="org.springframework.jms.connection.JmsTransactionManager"> <property name="connectionFactory" ref="amqConnectionFactory" /> </bean> <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser"> <property name="password" value="*

Error with JPA transaction when calling a stored procedure

China☆狼群 提交于 2019-12-25 07:57:54
问题 I have a stored procedure in an Oracle DB, which I wish to call from my EJB AS (websphere) using the following JPA code. The procedure includes some "COMMIT" in its body. The point is that when I remove the COMMIT of the procedure, JPA is able to invoque the procedure correctly. If I leave the COMMIT then I get an exception telling me that the call cannot be executed. The java code is placed in a session bean with the transaction set up as REQUIRED by default. public void updateProc() { Query

mysqli - handling errors with transactions

假如想象 提交于 2019-12-25 07:48:23
问题 How to properly handle errors with transactions and prepared statements when using mysqli? Snippet: <?php $conn = require_once 'dbconn.php'; $conn->autocommit(FALSE); $stmt_ins_option = $conn->prepare('INSERT INTO options(option_name) VALUES(?)'); $option_name = 'foo'; $stmt_ins_option->bind_param('s', $option_name); $stmt_ins_option->execute(); $conn->commit(); if($conn->errno) { $conn->rollback(); echo $conn->error; } It won't add it a second time because there's a UNIQUE constraint on that

Duplicate entry on INSERT after DELETE from table in transaction

寵の児 提交于 2019-12-25 07:29:06
问题 I'm looking for any ideas to explain (and prevent) the following: 1) We have a Magento reindex process (price or stock) that is failing from time to time with: exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '512723-1-1' for key 'PRIMARY'' in /[omitted]/lib/Zend/Db/Statement/Pdo.php:242 Full trace: https://gist.github.com/werdan/5255362 2) Magento reindex is done in transaction, which can be sketched as following: