transactions

ASP.Net master/detail w/Databinding to DataSource objects - multi-insert with all-or-nothing principals

My goal is to allow the user to enter order header and detail data and have it all save with a single button click, in one transaction so the save is all or nothing. For example: Tables: OrderHeader: Id, CustomerId, Comments, OrderDate, OrderLine Id, OrderId FK => OrderHeader Produ...

LINQ + TransactionScope will not change isolation level in SQL Server Profiler

Hi Guys, I'm using the following format for commiting changes to my db using linq. Begin Transaction (Scope Serialized, Required) Check Business Rule 1...N MyDataContext.SubmitChanges() Save Changes Done In Previous Query To Log File End Transaction Scope But in the SQL Server profiler I see the following line in the Conne...

SQL server transaction

I need to understand about sql server transaction? I have gone through some articles available on google but I have not understood anything. Can anyone help me? ...

vb.net 2008 / Imports System.Transactions ?

Using vb.net 2008. I am trying to use TransactionScope but when I put "Imports System.Transactions" at the top of my module it is not taking it. Do I need to do some setting or something? ...

Spring + Hibernate transaction takes 25 seconds doing nothing

I have a Java application using Spring + Hibernate. I have a pretty simple transaction that just recently started to take REALLY long to execute (~25 secs) though it's not making any obscure / complex queries, and according to the log, those 25 seconds are spent within Hiberante's code. The browser just hangs there waiting until it's don...

MySQL XA Transaction in two different connections, rollback of one doesnt rollback all

Hi all! maybe I totally misunderstand XA Transactions (I'm no DBA), but I have the following problem: - I open two sql connections (to the same DB) - "set autocommit=0" in both sessions - XA start '1234','56'; in one session - XA start '1234','57'; in other session - insert something in both sessions - "xa end", "xa prepare" and "xa com...

@Transactional annotation doesn't work

ok, enough. I couldn't make this work. I am a newbie to Spring transactions and using the @Transactional annotation in my service to manage transactions. Below is my spring bean configuration file. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/X...

LINQ Insert Into Database resulted in duplicates

I have a linq query running in a WCF Web Service that looks for a match and if one is not found then it creates one. my code looks like //ReadCommitted transaction using (var ts = CreateTransactionScope(TransactionScopeOption.RequiresNew)) { Contract contract = db.Contracts.SingleOrDefault(x => x.txtBlah == str); if (c...

How to commit and rollback transaction in sql server?

Hi, I have a huge script for creating tables and porting data from one server. So this sceipt basically has - Create statements for tables. Insert for porting the data to these newly created tables. Create statements for stored procedures. So I have this code but it does not work basically @@ERROR is always zero I think.. BEGIN TR...

scaleability of failing transactions mysql

I have a table that stores messages from one user to another. messages(user_id,friend_id,message,created_date). My primary key is (friend_id,created_date). This prevents duplicate messages (AFAIK) because they will fail to insert. Right now this is ok because my code generates about 20 of these queries at a time per user and I only hav...

NHIbernate affecting non-nhibernate queries?

I have got an odd problem with NHIbernate, and seeing as this is my first NHIbernate project I thought I'd ask the good people of StackOverflow.com. I'm following the 'Open session in view' pattern in ASP.Net, which opens a hibernate transaction on each request and commits it at the end of the request. This works fine normally, howeve...

Nhibernate in MVP WinForms application implemented by Conversation per Business Transaction

Hello, I've started using nHibernate some time ago. But after some time I saw that something goes in wrong way. The application is written in MVP pattern. Whole application is 3-tier. I have a Repository layer, Service layer and MVP. Presenter is providing a SessionWrapper to services and then it's provided to repositories. So the whole...

Which isolation level to use to prevent data from being read?

I have situation like this. Query is like this. Select * from TABLE where ID = 1 (what a query :) after that I change stuff in that row and INSERT it with new id. I want to prevent other qeueries to read that first original row from query, untill I finish the read and insert. After that..go ahead. Basicly I want select and insert...

Basic Database Question?

I am intrested to know a little bit more about databases then i currently know. I know how to setup a database backend for any webapp that i happen to be creating but that is all. For example if i was creating three different apps i would simply create three different databases and then configure each database for the particular app. Thi...

What is the best design pattern for preventing duplicate submissions?

I have a design pattern I have been struggling with on how best to prevent duplicate posting of data. Here are the steps: Client submits data with a unique guid (client generated guid - guaranteed unique) Server side software makes sure client guid doesn't exist yet in the DB begins transaction process data (can take between 1-20 seco...

Hibernate Transaction information

Given that you have a lot of domain objects, that all interact with one another, it would be very useful to know which objects have changed in a particular transaction. Is this possible ? I would like to essentially do this : public void someBusinessLogicMethod(someparams) { Session s = getSession(); Transaction tr = s.beginTransac...

What should a student be taught about database transactions?

There's lots that can be taught about transactions in databases (and I'm really talking about relational databases here, since that's what I'm currently teaching), but I believe it's easy to teach the wrong things. Given that students are very likely going to forget most of what you say before they leave the lecture room, where should th...

Can a COMMIT statement (in SQL) ever fail? How?

When working with database transactions, what are the possible conditions (if any) that would cause the final COMMIT statement in a transaction to fail, presuming that all statements within the transaction already executed without issue? For example... let's say you have some two-phase or three-phase commit protocol where you do a bun...

Transaction not rolling back

I have a transation that doesn't seem to rollback and getting a strange error. I'm using a transaction that is connected to SQL Server 2008 on a different server and MSMQ on the same server as the code. Here is an example of the code: void MyMethod() { try { using (var outterTrans = new TransactionScope())...

How to wrap an object change in my own transaction and incorporate it with Hibernate to JTA?

I have a web-app, which I deploy on Tomcat 6 and it uses Hibernate. It receives messages on a JMS queue which trigger changes both to my DB, via Hibernate and to an Object of mine (Agent). The web-requests also access the DB, via Hibernate, and access the shared object (there's a ConcurrentHashMap<AgentId,Agent> held by a singleton). My ...