transactions

MySQL transaction query help

This problem is baffling me: BEGIN; INSERT INTO sub_users(user_id, email) SELECT user_id FROM users WHERE email='[email protected]', '$email'; COMMIT; Normally, I have multiple statements in that transactions, but I've removed those for clarity. I get this error: #1064 - You have an error in your SQL syntax; check the manual that...

NHibernate with Autofac within ASP.NET (MVC): ITransaction

What is the best approach to managing NHibernate transaction using Autofac within web application? My approach to session is builder.Register(c => c.Resolve<ISessionFactory>().OpenSession()) .ContainerScoped(); For ITransaction, I have found an example on Google Code, but it relies on HttpContext.Current.Error when deciding wh...

Linq to SQL Compact - Transaction or just SubmitChanges

I'm using Linq to SQL on an SQL Compact database. I have a function where I insert multiple records into the database. I only call SubmitChanges at the end of the function. Would using a transaction (using the TransactionScope class) bring me any more performance or advantages? ...

How To Make Transactions Work In Grails

Summary A parent can have many children. How do you write a service such that, if after adding a parent there is an error when adding a child, the entire transaction is rolled back. For example, add parent p1, successfully add child c1, then when adding child c2 an error occurs, both p1 and c1 should be rolled back. Detailed Problem In...

session.BeginTransaction() and transaction.Commit()

Hello there, I am new to Nhibernate, so my query may seem trivial to you. We generally embed data operation code inside using (var session = sessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { ...Code for CRUD operations transaction.Commit(); } } Because we generally BeginTransaction/Commi...

duplicate key error does not cancel/rollback mysql transaction

When in a mysql innodb transaction, I would expect a duplicate key error to cause a rollback. It doesn't, instead it simply throws an error and continues on to the next command. Once the COMMIT command is reached, the transaction will be committed, sans the duplicate key causing command. Is this the expected behaviour? If so, how would ...

best practices for using sqlite for a database queue

I am using an sqlite database for a producer-consumer queue. One or more producers INSERT one row at a time with a new autoincremented primary key. There is one consumer (implemented in java, uses the sqlite-jdbc library) and I want it to read a batch of rows and delete them. It seems like I need transactions to do this but trying to u...

TransactionProxyFactoryBean when switching from configuration-based Service beans to annotation based service beans

Hi guys, I read about using <context:component-scan base-package="tld.mydomain.business"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/> </context:component-scan> and annotate my service beans with @Service("myService"), and thought great, I'll do that, since I'm already doi...

Multiple Service Layers and Database Transactions

I'm just wondering how to best handle transactions across multiple service layers. The service layers use an ORM to store and retrieve from the database. Should the transactions be known and handled within the individual service layers? Or should they be handled by another layer? For example: I have two service layers for users and clie...

Transaction between several DAO layers ?

As shown below, I am accessing a Service layer method inside of another DAO. (Every DAO in the system is implemented using HibernateDAOSupport class) I wanted to rollback the transaction when #1 or #2 (commented in the following code) is failed. But when #2 throws an exception, #1 does not get rolled back and I can see the entries in th...

Spring Transactions in diffrent DAOs does not work anyway?

Here is my implementation in summary 1) all DAOs implemented using HibernateDAO support/ @Transational annotation is only used in Service layer 2) Use MySQL / HibernateTransactionManager 3) Test using main(String args[]) method (do transactions work using this method? ) Transactions does not get rollbacked and invalid entried can be...

Transactional services => BeanNotOfRequiredTypeException, should be Advice, but is TransactionInterceptor

Hi guys, After following the great advice given in a thread about service beans I have made a Service that is listed under. I've tried putting @Transactional at the interface level, interface method level, class level and class method level. However I do it, I get org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean n...

Changing a full-text indexed column within a transaction

I'm writing an SQL data updater to convert old text/ntext/image type columns into varchar/nvarchar/varbinary. The updaters are run within transactions when the system boots to update the database from an older version. I've gotten the SQL to work on its own, but a handful of the columns being changed were full-text indexed, which means I...

Firebird 2.0 transaction SELECT performance

In Firebird 2.0, is using an explicit transaction faster on a SELECT command than executing the command with an implicit one? ...

Handle transactions for two independent data sources as one

I have two data sources: a legacy one (web service) and a database one. Now, when I process request, I made changes to both. In case of error, I want to rollback both. try { legacy.Begin(); db.Begin(); legacy.MakeChanges(); db.MakeChanges(); } except (Exception) { legacy.Rollback(); db.Rollback(); } The problem is, what if legac...

Java Transaction API (JTA) Overview Help

Can someone give me a good explanation on the motivation and application of JTA in modern Java applications? I don't want overly technical details. But just a paragraph on why do we need JTA, what does JTA accomplish, and maybe a piece of pseudo code showing how JTA is being used? ...

How to check for pending operations in a PostgreSQL transaction

I have a session (SQLAlchemy) on PostgreSQL, with an active uncommitted transaction. I have just passed the session to some call tree that may or may not have issued SQL INSERT/UPDATE/DELETE statements, through sqlalchemy.orm or directly through the underlying connection. Is there a way to check whether there are any pending data-modify...

WS-AT Issue between WPS 6.2 and WAS 7.0

Hi, I have a BPEL running on WPS 6.2 trying to call a web service on developed on RAD 7.5, deployed on RAD test environment. I have setup WS Transaction policy on both client and server. I get an error on WAS 7.0 saying Must Understand check failed for headers: {http:// schemas.xmlsoap.org/ws/2004/10/wscoor}CoordinationContext...

Merge replication and Transactions

I've read somewhere that using merge replication there is no transaction. Is there a way to use merge replication + transaction? ...

How does transaction propagation work when using Open Session In View?

I'm really confused about transaction propagation in Spring with Hibernate. I use Spring @Transactional annotations on my service layer methods. Some are marked as 'read-only=true'. If one of my read-only service methods calls a method that is not read-only, how can I deal with this? I'm thinking I can mark all my read-write methods to ...