As far as I understood DataSourceTransactionManager binds a JDBC connection from the specified DataSource to the current thread, allowing for one thread-bound Connection per DataSource. If it's a pool of connections, it will take one of the available connections.
After this if I use JdbcTemplate inside a transaction, it will capture a c...
I maintain a SQL Server-based application that requires us to send notifications of certain database changes to connected clients. These clients are fat-client C++ apps with high-bandwidth connectivity to the server.
Up until this point, we've been using a dedicated messaging table in SQL Server which is updated via triggers on the rel...
I am relatively new to both WPF and NHibernate and attempting to build an application that combines the two, using the MVVM pattern. However, I am struggling to understand when and where my application should open and close NHibernate sessions and transactions.
From what I have read, it is recommended that sessions should be kept as sho...
What is the best way to keep code modular and decoupled but avoid entering a transaction twice?
Entities often have class methods to load, modify, and store data. Often, this must be transactional to be consistent with child/sibling/cousin entities. Here is the pattern:
class MyEntity(db.Model):
# ... some properties
@classmethod
...
I'm using Hibernate 3.3 in a Swing application. I'd like to retrieve some stats on the performed transaction and make that info available to my views. For example:
Execution time
Number of rows touched
Type of transaction (update, delete, create, select etc)
I have several helper classes. I'm thinking of having some public fields lik...
Hi,
For example, there's remote API with the following calls:
getGroupCapacity(group)
setGroupCapacity(group, quantity)
getNumberOfItemsInGroup(group)
addItemToGroup(group, item)
deleteItemFromGroup(group, item)
The task is to add some item to some group. Groups have capacity.
So first we should check if group is not full. If it is,...
Hi,
I have a certain scenario where inserts and updates are done on multiple tables based on some constraints ..so its natural to use Transaction scope for these scenarios.Now,I have a respository layer and a service layer. service layer mediates the repository and the UI and is persistent ignorant.
Now i m confused where to use the tran...
I'm using Hibernate with OpenSessionInViewInterceptor so that a single Hibernate session will be used for the entire HTTP request (or so I wish). The problem is that Spring-configured transaction boundaries are causing a new session to be created, so I'm running into the following problem (pseudocode):
Start in method marked @Transacti...
I was curious about the TransactionScope class.
For the most part, I assume it was intended for database connections (which is what I've used it for).
My question, is can you put any code in the using-block of a TransactionScope to make it transactional? MS documentation is not clear on this.
If it can be used to make code other than...
I'm working on an AJAX application using GWT, Spring and Hibernate. I'm keeping some configuration data on the client side, which is almost never changed, but when it is changed, I have to notify all clients about the changes via a data change event using GWTEventService.
All of this is already working, but I noticed a problem concernin...
Hi i am using the transaction-per-request (session-in-view) pattern for an asp.net web application. I have a couple of points in the application where i want to Save an NHibernate managed entity and then do a couple of more inserts and updates using common sql. These inserts/updates depend on the ID that the NH saved entity will take.
T...
How can I set XACT_ABORT to ON (or OFF) from within ADO.NET ?
...
Many examples out there advocate explicit rollback of database transactions, along the lines of:
using (var transaction = ...)
{
try
{
// do some reading and/or writing here
transaction.Commit();
}
catch (SqlException ex)
{
// explicit rollback
transaction.Rollback();
}
}
Howeve...
Hi all!
I have made a database wrapper with extra functionality around the PDO system (yes, i know a wrapper around a wrapper, but it is just PDO with some extra functionality). But i have noticed a problem.
The folowing doesn't work like it should be:
<?php
var_dump($db->beginTransaction());
$db->query('
INSERT INTO test
(data) VA...
I've been using TransactionScope to work with the database and it feels nice. What I'm looking for is the following:
using(var scope=new TransactionScope())
{
// Do something with a few files...
scope.Complete();
}
but obviously this doesn't work -- if there are 20 files, and an exception occurs on the 9th file,...
Hi all,
I want to write a history component that tracks changes to a particular object type and writes history rows based on the difference. Note this is not a general audit system it is specific for one object type.
I figure I can hook into the hibernate event model and listen for events that tells me when things have changed, watch ...
I'm getting locking exceptions when trying to use transactions with SubSonic and SQLite. I'm using this from a single thread and there are no other processes accessing my db, so I really didn't expect any such problems.
If I write code like this below, I get an exception on the second call to Save() within the loop - so the third call ...
Hi,
I'm importing some content into a Nested Tree model, and I'm implementing a Transaction to be sure each object has been saved; and if not, remove it from the tree. I'm using Doctrine 1.1.6.
// Start the transaction
$conn = Doctrine_Manager::connection();
try {
$conn->beginTransaction();
// add it as a child of the suburb
$ob...
We have two Linux servers, ServerA and ServerB. The system time on ServerA seems to be slightly behind ServerB, only by a few hundredths of a second.
I am trying to diagnose an issue with a distributed transaction and have noticed slight inconsistencies between the times of the two servers, but I need some way to prove it. I need someth...
Saw the same question posited for PostgreSQL here; wondering if anyone knows (a) the MySQL flavour of the response and (b) which MySQL options I would examine to determine/influence the answer.
I don't need an absolute answer btw, but if I were to propose inserting, say, 200,000 rows of ~2Kb each would you consider that very straightfor...