transactions

Transaction Documentation Incorrect

The documentation found at: http://subsonicproject.com/active-record/transactions/ is wrong. The SharedDbConnectionScope should be within the TransactionScope. So it should look like: using (TransactionScope ts = new TransactionScope()) { using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope()) { Prod...

Using TransactionScope with typed dataset

I have a WinForm application querying SqlCe database using typed-dataset tabledapters. I have a main form assembly and a database assembly which handles every db operation. I'm having problems with updating using tableadapter in a transaction and I'd appreciate if anyone could give me any ideas why. Update() method gives this error: "...

How to use transactions with the Entity Framework?

When you have code like this: Something something = new Something(); BlahEntities b = new BlahEntities() b.AddToSomethingSet(something); b.SaveChanges(); how do run that addition inside a transaction? ...

Transaction commit executes succesfully but not getting done

I've encountered a strange problem in Sql Server. I have a pocket PC application which connects to a web service, which in turn, connects to a database and inserts lots of data. The web service opens a transaction for each pocket PC which connects to it. Everyday at 12 P.M., 15 to 20 people with different pocket PCs get connected to the ...

Object Context, Repositories and Transactions

I was wondering what the best way to use transations with the entity framework. Say I have three repositories: Repo1(ObjectContext context) Repo2(ObjectContext context) Repo3(ObjectContext context) and a service object that takes the three repositories: Service(Repo1 repo1,Repo2 repo2, Repo3 repo3) Serive.CreateNewObject <- cal...

How to raise an ActiveRecord::Rollback exception and return a value together?

I have a model that uses a acts_as_nested_set fork, and I've added a method to the model to save the model and move the node into the set in one transaction. This method calls a validation method to make sure the move is valid, which returns true or false. If the validation fails, I want my save method to raise ActiveRecord::Rollback to ...

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

Just curious if anyone else has got this particular error and know how to solve it? The scenario is as follow... We have an ASP.NET web application using Enterprise Library running on Windows Server 2008 IIS farm connecting to a SQL Server 2008 cluster back end. MSDTC is turned on. DB connections are pooled. My suspicion is that some...

Transactions - A scenario

I have a subscriber on a bus to NewDeriative messages, which is flat and primitive DTO style, for example sake has three strings ModelName, ManufacturerName, DerivativeName. Inside the system there is a domain model of Manufacturer, Model and Derivative, a derivative has a Model, and a model has a Manufacturer. E.g. BMW --> X5 --> Sport...

How to implement transaction over multiple databases

i am updating/inserting/deleting values on more than 1 database and want to implement a transaction. currently its done like try{ db[1].begintransaction(); db[1].ExecuteNonQuery(); db[2].begintransaction(); db[2].ExecuteNonQuery(); ... db[N].begintransaction(); db[N].ExecuteNonQuery(); // will execute only if no exception raised du...

In Python, Using pyodbc, How Do You Perform Transactions?

I have a username which I must change in numerous (up to ~25) tables. (Yeah, I know.) An atomic transaction seems to be the way to go for this sort of thing. However, I do not know how to do this with pyodbc. I've seen various tutorials on atomic transactions before, but have never used them. The setup: Windows platform, Python 2.6,...

Rollback transaction using transaction log

Would it be possible rollback transactions using Transactionlog file for a particular record? I am using MS SQL 2005. ...

How to rollback a transaction in Entity Framework.

string[] usersToAdd = new string[] { "asd", "asdert", "gasdff6" }; using (Entities context = new Entities()) { foreach (string user in usersToAdd) { context.AddToUsers(new User { Name = user }); } try { context.SaveChanges(); //Exception thrown: user 'gasdff6' already exist. } catch (Exception ...

How to progromatically know to rollback a transaction (can do it in SQLServer, but need oracle solution)

This seems like it should be something I already know. We need to run a bunch of sql updates in a transaction, and rollback if one of them fails. We also want to print a status message since we'll be running a large number of these. This would be simple if I were doing it in a general purpose programming language. But I am trying to...

Does SQL Server wrap Select...Insert Queries into an implicit transaction?

When I perform a select/Insert query, does SQL Server automatically create an implicit transaction and thus treat it as one atomic operation? Take the following query that inserts a value into a table if it isn't already there: INSERT INTO Table1 (FieldA) SELECT 'newvalue' WHERE NOT EXISTS (Select * FROM Table1 where FieldA='newvalue...

Does RandomAccessFile.close() internally call FileChannel.force()?

I am using RandomAccessFile to perform some writes to a file as part of a transaction. Before I commit my transaction, I want to be absolutely sure that the data is written to disk. Calling force(boolean) on the RAF's FileChannel appears to provide this guarantee, but is it called implicitly when I close the file, or do I have to call ...

Finding events in a transaction file where more than 5 serial numbers appear in sequence within 100 transactions.

I've had an unusual client request in regard to fraud detection in an online raffle which I'm trying to build as efficently as possible by pushing as much of the task into SQL as possible. The structure is thus: table: codes raffle_code | ticket_type | sequence A00000001 Red 1 A00000002 Red 2 ... A0000...

In Rails, do I need to worry about failed transactions if the same model gets updated by two different mongrels?

I have a fairly vanilla rails app with low traffic at present, and everything seems to work OK. However, I don't know much about the rails internals and I'm wondering what happens in a busy site if two requests come in at the same time and try to update the same model, from (I assume) two separate mongrel processes. Could this result i...

Spring @Transactional Annotation Best Practice

We are currently discussing the Best Practice for placing the @Transactional annotations in our code. Do you place the @Transactional in the DAO classes and/or their methods or is it better to annotate the Service classed which are calling using the DAO objects? Or does it make sense to annotate both "layers"? ...

Hibernate session / transaction design

Hey, I'm trying to figure out how to best use Sessions in (N)Hibernate. I have a C# remoting object (MarshalByRefObject) which gets consumed by an ASP.NET client. Currently my remoting class opens up one Session instance in the constructor and uses that one for all transactions. Is this a good idea? And would I need a finalizer for the ...

what are queue access concurrency solutions?

I am trying to find out the difficulty of implementing a queue system. I know how to implement a basic queue, so i'll explain a little about what i'm after with some background: I will be implementing a queue where messages will be placed, this will come from several users, the messages will be scheduled to be posted at user defined tim...