transactions

Transaction Stored Procedure C#

Hi All, I am having a slight issue. Please guide me. I am coding in C#(Console App). I have called 2 different stored procedure in my code. Basically both these stored procedures access the same table. First SP has a select query and an update query. Second SP has a single update query. Now I want to call these SP in a transaction mode(...

NHibernate extract DBTransaction from Session

Hi there, I have an legacy db where some stored proc calculates the row ids for all the tables. Now I want to overwrite the IIdentifierGenerator as hinted at this page http://www.richter-web.info/Wordpress/?p=132 just to avoid the Id(x => x.id).GenereatedBy.Assigned. Now as I save some object,of course inside an Nhibernate transaction,...

SQL Server Transactions --- C#

Hi All, I need a help. Let me first explain the scenario with a small sample. Suppose I have a Students table with columns: Id int(PK) Name varchar(200) Marks1 int Marks2 int Marks3 int TotalMarks int IsTotalCalculated bit InProcess bit This table has huge number of records. Now, I want to calculate the TotalMarks...

do you see any problem with that stored procedure template?

so I created that(I used some stuff found on other website) to handle transactions and having a sort of stacktrace while executing stored procedure that could call other stored procedure that need transaction and etc. so if I have A calling B and B is calling C and C got an error, I can correctly rollback my stuff and returning a stackt...

How to delete and insert records with the same primary key using Linq transactions

We have a single table in the database that represents a bunch of divs in our web page. Each div has a pixel width, height, top, and left saved as individual records in the table. It has a primary key. We load all divs from the table to the web page, the user rearranges the squres, then in a single transaction saves the altered square...

Where would you typically implement transaction logic in domain-driven design?

In the consumer code? (like a controller) In repositories? In services? ...

Transaction on objects in C#

I was wondering if there is a way to have a transaction on object. I'm asking this question for the following situation: We pass our object to our dataaccesslayer. There we use transactionscope to make sure the database doesn't get corrupted. In that process an object can be changed (datechanged, owner, ect ...). But if the transaction...

NHibernate: Select MAX value concurrently

Suppose I need to select max value as order number. Thus I'll select MAX(number), assign number to order, and save changes to database. However, how do I prevent others from messing with the number? Will transactions do? Something like: ordersRepository.StartTransaction(); order.Number = ordersRepository.GetMaxNumber() + 1; ...

Rails' new_record? not reset (to true) if transaction is rolled back

So take the following test in Rspec: require 'spec_helper' describe Author do self.use_transactional_fixtures = false after(:each) do Author.destroy_all end it "should behave normal when using transactions" do my_author = nil begin Author.transaction do my_author = Author.new(:name => "My Name") ...

Can a transaction have many threads?

Generally We have some business logic that is causing a bottle neck within a transaction. The business logic queries the database for a set of data (read only), processes it, and returns an object. This must be done many times with varying parameters in a given request. Can we theoretically break off each business logic call into a sepa...

Berkeley DB in multithreaded applications

Hi, What is the best way to use berkeley DB (bdb) handles in a multi-threaded application? Is it better to have each thread open its own handle; or, is it better to open a single handle and have each thread do txn_begin { } txn->commit()? Which one scales better? I am using Transactional Data Store with DB_THREAD flag. Thanks ...

Mysql deadlock explanation needed

I received the following deadlock log via "SHOW INNODB STATUS". Can someone care to explain why the transaction was aborted? It seems that Transaction 2 is holding the lock, but is also stuck requesting the same lock (except for the "waiting" part), which leads to a deadlock when Transaction 1 requires it as well. ======================...

does ejb commits on connection?

i am using session bean in my application and transaction is controlled at EJB layer only. The problem that i am facing is with some commit. I am using the same connection as used by EJB to insert into one table, but if the transaction is committed then that insert is not committed into the database.. can any one help me with the problem...

Dependable insert with SQLite

I'm writing a program in C# that needs to insert data in multiple tables. The first insert returns a last insert rowid, which is in turn used to perform an insert on the other tables. In pseudo code: INSERT INTO TableFoo (Col2, Col3, Col4, etc.) VALUES (@Bla2, @bla3, @bla4); Immediately after this insert I get the last insert id by: ...

JTA: how to be test JMS and JDBC failures?

Hi all, we're currently working on testing JTA failure behaviour, on a system that receives messages using JMS, persists them, and sends results using another class. The whole thing is tied together using Spring. Current unit tests use HSQLDB, Apache ActiveMQ and Bitronix for transaction management. Success with this has been limited, ...

Can I rollback Dynamic SQL in SQL Server / TSQL

Can I run a dynamic sql in a transaction and roll back using EXEC: exec('SELECT * FROM TableA; SELECT * FROM TableB;'); Put this in a Transaction and use the @@error after the exec statement to do rollbacks. eg. Code BEGIN TRANSACTION exec('SELECT * FROM TableA; SELECT * FROM TableB;'); IF @@ERROR != 0 BEGIN ROLL...

triggers statement level atomicity

What does Oracle mean by "statement level atomicity"? ...

tempdb SQL Server locking

Hello! Our application runs alongside another application on a customers machine. We have put some efforts regarding avoiding long-running locks in tempdb since this obviously affects concurrency badly. The other application, however does things like: begin transaction create #Table(...); insert into #Table(....) values(...

Creating a "secondary ID" in mysql.

I have a table that stores "records" and already has primary key. Table A ======= id (INT) PK auto_increments project_id (INT) record_text (TEXT) This table stores "records" for all of my projects. It is desirable to have a secondary key that auto increments for the projects. Example: If project 1 had id's of (1,5,8,9). It would...

How can I implement a MultiThreaded Transaction in C#?

I want to run set of different commands on different tables in parallel and in a transactional way, how can I do that? More details: I want all the commands to be distributed over threads but in a single transaction, so if all the threads succeed I'll commit else rollback. ...