I have next block in the end of each my stored procedure for SQL Server 2008
BEGIN TRY
BEGIN TRAN
-- my code
COMMIT
END TRY
BEGIN CATCH
IF (@@trancount > 0)
BEGIN
ROLLBACK
DECLARE @message NVARCHAR(MAX)
DECLARE @state INT
SELECT @message = ERROR_MESSAGE(), @state = ERROR_STATE()
...
Hi,
I am developing an application using Eclipselink and as part of the app I need to be able to manipulate some of the objects which involves changing data without it being persisted to the database (i merging/changing objects for some batch generation processes).
I am reluctant to change the data in the Entity objects, as there is a...
My application requires a user to log in and allows them to edit a list of things. However, it seems that if the same user always logs in and out and edits the list, this user will run into a "System.Data.SqlClient.SqlException: Timeout expired." error. I've read a comment about it possibly caused by uncommitted transactions. And I do ha...
How can i find out if there is transaction open in mySQL? I need to start new one if there is no transaction open, but i don't want to start new one if there is one running, because that would commit that running transaction.
UPDATE:
i need to query database in one method of my application, but that query could be called as part of bi...
I've implemented some components to use WCF with both an IoC Container (StructureMap) and the Session per Call pattern. The NHibernate stuff is most taken from here: http://realfiction.net/Content/Entry/133.
It seems to be OK, but I want to open a transaction with each call and commit at the end, rather than just Flush() which how it...
Is there any way to set MySQL to rollback any transaction on first error/warning automatically?
Now if everything goes well, it commits, but on failure it leaves transaction open and on another start of transaction it commits incomplete changes from failed transaction. So i need to rollback automatically those failed transactions..
(I'...
Hi,
I have a situation where I am using NHibernate in a WCF service and using a TransactionScope for the transaction management. NHibernate enlists in the ambient transaction fine, but, any changes I make and save inside the transaction, are not visible to any queries I make while still in that transaction.
So if I add an entity and ses...
Consider this situation:
Begin transaction
Insert 20 records into a table with an auto_increment key
Get the first insert id (let's say it's 153)
Update all records in that table where id >= 153
Commit
Is step 4 safe?
That is, if another request comes in almost precisely at the same time, and inserts another 20 records after step 2 ...
I'm using JPA 1.0 with hibernate as my provider. Inside an entitymanager transaction, if a series of native queries are run (which include DELETE sql statements) and an error occurs, will the native queries rollback too on the error?
I ran into a deadlock problem in an oracle database and I noticed that it left the database inconsistent...
Consider to following method that read data from some data-structure (InteractionNetwork) and writes them to a table in an SQLite database using an SQLite-JDBC dirver:
private void loadAnnotations(InteractionNetwork network) throws SQLException {
PreparedStatement insertAnnotationsQuery =
connection.prepareStatement(
...
Quick version:
We're looking for a way to force a transaction to rollback when specific situations occur during the execution of a method on a backing bean but we'd like the rollback to happen without having to show the user a generic 500 error page. Instead, we'd like the user to see the form she just submitted and a FacesMessage that i...
Looking into the documentation it says that the Rollback method can throw when the transaction is not in pending state (after begin transaction and before commit transaction).
I can't seem to find a way to check whether the transaction can be rollback or not. There isn't a state property either.
...
When users make credit card transactions on my web app, I'd like to include the transaction fee on the confirmation page before the user makes the order. The thing is, there are different transaction fees for different cards. Is there a way to determine a transaction fee from the card number?
I'm using Rails and ActiveMerchant, but I fi...
Let's say I have the following code in a form that is triggered on some click event.
DoCmd.SetWarnings False
DoCmd.OpenQuery "AddSomeStuff"
DoCmd.OpenQuery "UpdateSomeOtherStuff"
DoCmd.OpenQuery "DeleteABunchOfCrap"
DoCmd.SetWarnings True
Can I assume that the three update queries I executed (in SQL Server) are not transactional in th...
Hi
is it possible on the following try-catch to execute a set of statements as a transaction using ADO NET Entity Data Model?
[ValidateInput(false)]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Customer c)
{
try
{
c.Created = DateTime.Now;
c.Active = true;
c.FullName = Request.Form["FirstN...
Hi,
I am building REST API in php with memcache layer on top for caching all resources. After some reading/experience it turns out it's best when documents are as simple as posible...mainly due to dropping cache sequences.
So if there is 'building','room' entities for the 'room' document I would only place the id of the 'building' and...
I have a website with Dutch text which I want to translate to English. Is there a fast way of doing this with keeping the HTML tags(<strong>,<span>) in tact. I know I can just copy the parsed TEXT into a translator but this will remove the formatting.
I also know that at the end I have to go trough the text manually to fix some minor sp...
I have a getStockQuote() function that will get a current stock quote for a symbol from the stock market.
My goal is that within a JTA transaction, the first call to getStockQuote() will fetch a stock quote, but all subsequent calls within the same transaction will reuse the same stock quote (e.g.: it will not try to fetch a new quote)....
I'm looking for a description of the root of this error: "Transaction context in use by another session".
I get it sometimes in one of my unittests so I can't provider repro code. But I wonder what is "by design" reason for the error.
UPDATE: the error returns as SqlException from SQL Server 2008. A place where I get the error seems to...
in one dao I have 2 @Transactional methods.
if i do not provide any explicit properties,
then what will happen, if
I run one method in the body of another?
Both methods will run within THE SAME ONE TRANSACTION?
...