transactions

ejb-jar.xml : Allowed Methods for container-transaction tag

Hi, Are we allowed to specify a method name with an access modifier of 'protected' or 'private' inside the <container-transaction><method></method></contaner-transaction> tag ? Below is a sample of the ejb-jar.xml: <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1"> ...

Mysql transactions within transactions

In a PHP script working with a mysql database, I recently had the need to use a transaction at a point that happened to be inside another transaction. All my tests seem to indicate this is working out fine, but I can't find any documentation on this usage. I want to be sure - are transactions within transactions valid in mysql? If so,...

Handling transactions spanning across database servers

I have a scenario where the unit of work is defined as: Update table T1 in database server S1 Update table T2 in database server S2 And I want the above unit of work to happen either completely or none at all (as the case with any database transaction). How can I do this? I searched extensively and found this post close to what I am e...

Proper way to autowire a Hibernate Session in a Spring Transaction JUnit test

This question is similar to a previous one. I am trying to @Autowire a Hibernate Session in one of my Spring-JUnit-Transactional tests but I am getting this exception: java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional ... Here is my JUnit class: @RunWi...

Is there a way to use System.Transactions with connection pooling?

I think the System.Transaction classes in Framework 2.0 are a great tool, well designed, aimed to simplify code when working with transactions. But, (big but), it's impossible to use those classes with multiple connections to the same database (same connection string) without promoting to distributed transactions. http://social.msdn.m...

Hibernate/Ehcache: evicting collections from 2nd level cache not synchronized with other DB reads

I have an application using JPA, Hibernate and ehcache, as well as Spring's declarative transactions. The load on DB is rather high so everything is cached to speed things up, including collections. Now it is not a secret that collections are cached separately from the entities that own them so if I delete an entity that is an element of...

SQL Server 2005 Transactions

I have a long running stored proc (approx 30 mins) which is currently running within a transaction (isolation level snapshot). I've set the transaction to snapshot to avoid locking records preventing other processes from accessing the data. What I'm trying to do is write to and read from a status table, but although we're in a transacti...

Detecting errors to decide whether to rollback or commit

I'm trying to be as lazy as possible by generating a series of SQL commands in a file to feed to psql for processing. In a nutshell, I'm loading a series of import tables from outside sources (already done, via COPY), and then in a final step, deleting/updating/inserting records into the primary tables (which is functionally also done). ...

C# SQL Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.

I'm getting this error (Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.) when trying to run a stored procedure from C# on a SQL Server 2005 database. I'm not actively/purposefully using transactions or anything, which is what makes this error weird. I can run the stored proced...

NHibernate, transactions and TransactionScope

I'm trying to find the best solution to handle transaction in a web application that uses NHibernate. We use a IHttpModule and at HttpApplication.BeginRequest we open a new session and we bind it to the HttpContext with ManagedWebSessionContext.Bind(context, session); We close and unbind the session on HttpApplication.EndRequest. In ou...

Problem with Rolling back a linq2sql insert transaction in C#

Hi, i am trying to insert the contents of a CSV file into a database table using linq2SQL. I want to be able to rollback the transaction if ANY of the inserts fail but when i try with this code i get the following error at - db.Transaction.Commit() System.InvalidOperationException was unhandled: This SqlTransaction has completed; it is...

creating a table if it doesn't exist

Given the following: if object_id('MyTable') is null create table MyTable( myColumn int ) Is it not possible that two separate callers could both evaluate object_id('MyTable') as null and so both attempt to create the table. Obviously one of the two callers in that scenario would fail, but ideally no caller should fail, rather one sh...

Transaction state in JDBC

Is there a way to know if a transaction is in an "ongoing" state in JDBC? I found nothing in the Connection API. Thanks ...

Adding an arbitrary transactable service to an ADO transaction

Hi, I'm wondering if it's possible to create my own services that I can use in an ADO transaction. For example, I'd like to make some database updates in an ADO transaction make some arbitrary updates in some arbitrary service that I create either commit or rollback the transaction, and have my arbitrary service understand that the ...

Truncate Table Within Transaction

Can the SQL "truncate table" command be used within a transaction? I am creating an app and my table has a ton of records. I want to delete all the records, but if the app fails I was to rollback my transaction. Deleting each record takes a very long time. I'm wondering if I use truncate table, can I still rollback the transaction an...

mysql isolation levels

I'm a bit confused by the documentation here. I have a transaction, which start transaction does some updates does some selects does some more updates commit I want my selects at step 3 to see the results of updates in step 2 but I want to be able to roll back the whole thing. read committed seems to imply that selects only show ...

How to make a transaction flow from Navision to a C# component registered for COM interop?

In my context I have Navision involved, but perhaps this is related to every COM interop scenario, I don't know. Anyway, the situation: - I've a simple C# component registered for COM Interop - I call it from Navision, just before inserting a new record (for who knows Navision, inside an 'OnInsert' trigger, thus in the context of a tran...

Testing WCF Transaction time outs

I am using transactions across WCF client and services with netTcp binding. I have enabled DTC and transactions are flowing as expected. I want to test the transactions to timeout. The Client initiates transaction as using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,new TimeSpan(0,0,1,0))) ...

Is there a breaking point when a database transaction will get corrupted?

I'm interested in how database transactions "commonly" are implemented in a database system, like for instance MySQL. Assuming the actual writing of data to the physical database storage isn't an atomic operation (speaking in terms of clockcycles now), shouldn't I be able to corrupt a transaction by for instance ripping the power cable ...

Hibernate transaction boundaries

Hi, I'm using Hibernate (in a Grails app) and the transactional boundaries are service methods, i.e. every time a service method is called a transaction starts, and every time a service call completes the transaction is either rolled back or committed. If one of the database operations causes a database trigger to fire, and this trigge...