transactions

SQL Server transactions: insert causes locks?

◇◆丶佛笑我妖孽 提交于 2019-12-23 05:04:23
问题 I'm having the following issue: I'm inserting a row to table (say, 'temp') inside a transaction (default ADO.NET transaction). Until that transaction is committed, the command 'select * from temp', running from another session (SQL Server 2008 management studio), is blocked and cannot be completed. This seems weird to me. Shouldn't the read command return all the previous table rows (everything but the newly inserted row) and not get blocked? 回答1: The default behaviour in SQL Server is to

JPA RollbackException persist transaction causes subsequent valid transactions to fail?

两盒软妹~` 提交于 2019-12-23 04:52:22
问题 I have a @Transactional service performing a persist action into an oracle DB. If i run a persist breaking a unique violation i get the expected rollbackException:ConstraintException. The problem is that any subsequent request (even if not breaking the unique constraint) to persist throws the same exception. It seems like JPA is not clearing the object to persist out of its transaction manager? Am i even close? I need a little explaination. Repo: @Repository public class UserRepository {

How is Oracle ACID compliant when it does not honour 'isolation' property fully?

[亡魂溺海] 提交于 2019-12-23 04:35:45
问题 Claim: Oracle does not honour isolation property in ACID properties. As per Wikipedia page on ACID "Isolation ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially." This can happen only if the transactions are serializable. Yes, Oracle has a transaction level called Serializable but it is not true serializability and is only snapshot isolation. Read https://blog.dbi-services.com

Need to alter column types in production database (SQL Server 2005)

天涯浪子 提交于 2019-12-23 04:20:51
问题 I need help writing a TSQL script to modify two columns' data type. We are changing two columns: uniqueidentifier -> varchar(36) * * * has a primary key constraint xml -> nvarchar(4000) My main concern is production deployment of the script... The table is actively used by a public website that gets thousands of hits per hour. Consequently, we need the script to run quickly, without affecting service on the front end. Also, we need to be able to automatically rollback the transaction if an

How to use SQL Server table hints while using LINQ?

自作多情 提交于 2019-12-23 04:09:07
问题 What is the way to use Sql Server's table hints like "NOLOCK" while using LINQ? For example I can write "SELECT * from employee(NOLOCK)" in SQL. How can we write the same using LINQ? 回答1: Here's how you can apply NOLOCK: http://www.hanselman.com/blog/GettingLINQToSQLAndLINQToEntitiesToUseNOLOCK.aspx (Quote for posterity, all rights reserved by mr scott): ProductsNewViewData viewData = new ProductsNewViewData(); using (var t = new TransactionScope(TransactionScopeOption.Required, new

Transactional PDO with MVC across multiple models

你说的曾经没有我的故事 提交于 2019-12-23 04:07:07
问题 I'm building a site and have multiple segments of code, across multiple models, that needs to run within a transaction so if one fails, the code will roll back. Say I have a simple form to register a user. <form action="/register" method="POST"> <div> <label for="username">Username</label> <input type="text" name="username" id="username" /> </div> <div> <label for="username">Password</label> <input type="password" name="password" id="password" /> </div> <div> <label for="username">Email<

Is mongoDB's findAndModify “transaction-save”

匆匆过客 提交于 2019-12-23 02:51:21
问题 i know, there is no transaction support on mongo DB. But now i need to read an value of an document, increment by 1 and write the new value. Or - different way: Update an element and read the value at the same time. For this i like to use find and modify : http://www.mongodb.org/display/DOCS/findAndModify+Command this command updates an document and returns the value before updating. Is this happens in on (same like) transaction? The point is: is it possible that an other session updates the

Where should the transaction boundary be in a repository pattern?

我只是一个虾纸丫 提交于 2019-12-23 02:04:24
问题 I have a repository like so: public interface IRepository { void Save<T>(T entity); void Create<T>(T entity); void Update<T>(T entity); void Delete<T>(T entity); IQueryable<T> GetAll<T>(); } My question is, where should my transaction boundaries be? Should I open a new transaction on every method and commit it before returning? Or should it be around the entire repository so that the transaction is only committed when the repository is disposed/garbage collected? 回答1: Unit of Work is

Locking problems with sqlite and SubSonic when using transactions on a single thread

a 夏天 提交于 2019-12-23 01:19:06
问题 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 to Save() over all. using (TransactionScope ts = new TransactionScope()) { using (SharedDbConnectionScope sharedConnectinScope = new SharedDbConnectionScope())

How exactly do transactions with PHP PDO work with concurrency?

心不动则不痛 提交于 2019-12-23 00:52:12
问题 I'm making a webapp where they'll be multiple users interacting with each other and reading/making decisions on/modifying shared data. I've read that transactions are atomic, which is what I need. However, I'm not sure how it works with the PHP PDO::beginTransaction() I mean atomic as in if one transaction is editing some data, all other transactions also modifying/reading that data will need to wait until the first transaction finishes. Like I don't want two scripts reading a value,