transactions

A common way to make checking for nonexistence of a row and inserting it atomic?

I have a web-application. The flow of processing a form in it goes like this: Validate List errors or Insert/update the data In this particular scenario I'm developing a user registration process but I'm trying to find a common solution for all types of forms bases on checking availability of unique value in a database table. In thi...

Lost Update Anomaly in Sql Server Update Command

Hi, I am very much confused. I have a transaction in ReadCommitted Isolation level. Among other things I am also updating a counter value in it, something similar to below: Update tblCount set counter = counter + 1 My application is a desktop application and this transaction happens to occur quite frequently and concurrently. We re...

Is it possible to lock lazy filed in hibernate?

I have Category class containing list of products. Like this: public class Category{ ... @0neToMany @JoinColumn("category_id") List<Product> products; public List<Product> getProducts(); ... } When I call getProducts() I want to lock returned collection so that other transaction could not modify it while current one isn't comm...

C#/SQL Database listener help needed

I have a requirement to monitor the Database rows continuously to check for the Changes(updates). If there are some changes or updates from the other sources the Event should be fired on my application (I am using a WCF). Is there any way to listen the database row continuously for the changes? I may be having more number of events to...

Nested transaction support in J2EE 1.4

Hi, I read that EJB 2.x spec does not support nested transactions. But logically think we can call an EJB method that has REQUIRES_NEW txn attribute from another EJB method that acutally started a transaction Isn't this a valid case. If valid isn't this what is called nested transactions. Please point me if I am missing anything here....

how to calculate database transaction count per second and database growth

Hello , I need to learn about calculating database load of a project . Lets assume that the events below are firing when an insert is completed. Insert a new record to table1 Get the uniqueid from inserted and insert the uniqueid to another table , with some other parameters table1 is a cumulative dataware , so select count(1) from ...

When should I use transactions in my queries?

Hi, I'm reading on web, very detailed tutorials on how to use transactions with database types and database engines, but I haven't found some guide that teach me when and why I should use them. I know transactions are usually used for home bankings, so when we work with money data, but I can immagine they are used in many other ways. T...

Django and Postgres transaction rollback.

I have a piece of code that works in a background process which looks like from django.db import transaction try: <some code> transaction.commit() except Exception, e: print e transaction.rollback() In a test, I break <some_code> with data that causes a database error. The exception is following File "/home/comm...

Where should I commit a transaction -- in the Stored Procedure or in the calling application code?

I'm using PHP + Oracle and was wondering if there are any recommendations on where to commit my transactions. I call stored procedures to do all my inserts/updates/deletes, and currently am committing at the end of my stored procedures. I was wondering: Is there any difference between calling commit/rollback in my stored procedure vs...

What's an efficient way to find rows where the timestamp and identity are not in sequence?

Background: I have a MS SQL application that reads data from our Oracle billing database once an hour, looking for new payments. It does this by storing a timestamp based on the CRT_DTTM of the most recent timestamp found each time it runs. e.g. SELECT * FROM V_TRANS WHERE TRANS_CLS = 'P' AND CRT_DTTM > TO_DATE('2010-01-25 12:59:44...

Performing multiple database operations in a single REST call

I am trying to figure out the best way to call REST actions that perform multiple actions and multiple database updates from a single call. In my data model, I have Diners and LunchBoxes, and Foods. LunchBoxes are just many-to-many relationships between Diners and Foods, but with a count attribute that says how many of that type of f...

Is there a use case for nested autonomous transactions?

I was trying to come up with a real life programming problem that could be best solved by using autonomous transactions within autonomous transactions but could not think of any. Can you give me any ideas? Edit: I mean something like this: PROCEDURE outer_procedure IS BEGIN -- some code auto_proc1; END; / PROCEDURE auto_proc1 IS...

How to convert to ADO.NET transactions rather than SQL Server Transactions?

Right now i have code that initiates transactions on SQL Server using the intended method: ExecuteNonQuery(connection, "BEGIN TRANSACTION"); try { DoABunchOnStuff(connection); DoSomeMoreStuff(connection); JustAFewMoreThings(connection); ExecuteNonQuery(connection, "COMMIT TRANSACTION"); } catch (Exception) { ExecuteNo...

Using Transactions in Oracle

SELECT executed during the first command T1 is a transaction, in turn, DELETE command (at the time T2) is the first command transaction B. What will be the result of the SELECT statement at the time of T3 (a transaction)? The SELECT statement in T3 will return a row (because Transaction B is not committed yet) ? ...

SSIS transactions with multiple OLE DB commands

I have the following Data Flow task in my SSIS package: It reads a file from an external vendor that has records with a column "change" that cointains A, C or D for add, change and delete. I have to process these in my SQL Server database. The conditional split checks the value of the change column and sends the row off to the appropr...

MSDTC Configuration Automation

We are developing a large scale business application using most new technologies through .NET 3.5 and we are using EF as DataAccessLayer in our architecture in addition to Transaction management which automatically uses System.Transaction and MSTC. We need to deploy this application by ClickOnce method for over 300 end-user in each custo...

Can spring transactions unsynchronize a synchronized method?

My colleague and I have a web application that uses Spring 3.0.0 and JPA (hibernate 3.5.0-Beta2) on Tomcat inside MyEclipse. One of the data structures is a tree. Just for fun, we tried stress-testing the "insert node" operation with JMeter, and found a concurrency problem. Hibernate reports finding two entities with the same private key...

JBoss transaction timeout setting?

We have a timer service triggered task in JBoss 5.1.0.GA application and the problem is that we cannot change the transaction time out. This long Lucene indexing can take longer than the default 300 second limit. The question is how to change the timeout value, adding @TransactionTimeout(1800) to the worker method or the class did not ...

Data does not persist using HIbernate with Spring's @Transactional Annotation

I have an application that I am currently writing that will use Spring and Hibernate. In my services layer I have injected a DAO that will do some very basic CRUD-ing actions. For grins, I have created a method annotated as follows: @Transactional(readOnly = false, propogation=Propogation.REQUIRES_NEW) public void doSomeWork(Dao dao, En...

Transaction Filter Exception handling ASP.NET MVC

I am using S#arp Architecture on a project, which comes with the [Transaction] attribute for Controller methods. With this, the Transaction Commit is called as a OnActionExecuted filter, meaning it occurs after exiting the Controller method scope. My issue with this is what happens when an exception occurs during the commit? From the ...