w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
org.hibernate.TransactionException: nested transactions not supported
You can't have more then one transaction (not session) active at same time (I'm writing about your case). Probably your method is already under transaction and you don't need to create a new one; remove session.getTransaction().begin();. Look How to avoid nested transactions not supported error? In addiction, right pseudo-code for transaction management is: tx = begin tx; try { do database operations; commit tx; tx = null; } finally { if(tx != null) { rollback tx; } }

Categories : Hibernate

How to avoid nested transactions not supported error?
Use session.beginTransaction() instead of session.getTransaction().begin() in your code. You need to begin a new unit of work, so beginTransaction will begin a new transaction. So your code will look like: session = HibernateUtil.getSession(); Transaction transaction = session.beginTransaction(); ... to do .... transaction.commit(); Click Here to get more information about beginTransaction(); method. I think that will resolve your issue. Please let me know if issue persists.

Categories : Hibernate

Hibernate org.hibernate.TransactionException: nested transactions not supported on jaxrs
It seems that you are using programmatic transaction demarcation in your filter (as far as I understood). So please double check that you terminate properly each transaction, nevermind what append during the request (i.e. rollback if you get an exception and commit otherwise) : try { session.getTransaction().begin(); // call the filter chain session.getTransaction().commit() } catch (RuntimeException e) { session.getTransaction().rollback(); } Without the code it's difficult to be sure, but I guess that for some request you didn't terminate the transaction properly (i.e. by a commit or by a rollback). So the transaction remains associated to the thread and the thread go back to the thread pool (in a very strange state since there is still a transaction associated with it

Categories : Java

Nested transactions in spring
The default propagation strategy (REQUIRED) is a reasonable choice for the most of scenarios, therefore you can safely use it unless you have some very special requirements. In your second case REQUIRED would work almost the same way as if there were no @Transactional at DAO methods. The only subtle difference is in rollback-on-exception behavior: transaction is marked as "rollback only" when exception (the one that causes transaction rollback) passes a border of any transactional method, not just a top-level one, so that you won't be able to catch a rollback-causing exception thrown from your DAO method and make transaction commit. REQUIRES_NEW in your case is only needed if you want to be able to rollback inner and outer transactions separately.

Categories : Hibernate

Recommendations regarding nested transactions in SQL Server
When you do a BEGIN TRANSACTION an internal counter is incremented @@TRANCOUNT. ROLLBACK TRANSACTION will rollback all BEGIN TRANSACTIONS setting @@TRANCOUNT to 0. Doing a commit transaction will only decrement @@TRANCOUNT, it will do a full commit when @@TRANCOUNT is 1 before setting it to 0. With that in mind, Assuming you have paired BEGIN and COMMIT TRANSACTIONS in your Book and UnBook procedures I would do the RescheduleBooking procedure something like the following which will maintain the first book even if the unbook fails... CREATE PROCEDURE RescheduleBooking ... AS BEGIN BEGIN TRY BEGIN TRANSACTION EXEC BookAVehicle ... COMMIT TRANSACTION END TRY BEGIN CATCH IF @@TRANCOUNT > 0 BEGIN ROLLBACK TRANSACTI

Categories : Sql Server

Do nested transactions have any effect on locking
Neo4j has the notion of flat nested transactions. Flat nested transactions means that all nested transactions are added to the scope of the top level transaction. So in your case tx2 can mark the entire transaction for rollback and Neo4j will rollback both tx1 and tx2. In your case only tx1.finish will commit the transaction. All modifications within a Neo4j's transactions are kept in memory until commit or rollback. Locks are then obtained to do the actual flush. So in your case tx1.finish is when the locks are obtained. Read this section of the Neo4j manual for more information.

Categories : Neo4j

Total rollback on nested transactions
If you want the whole transaction be rolled back automatically as soon as an error occurs, you could just re-throw the exception from B's exception handler when called from some specific locations (eg. from A()): function A(){ ... $this->B(true); ... } /* * @param B boolean Throw an exception if the transaction is rolled back */ function B($rethrow) { $transaction=Yii::app()->db->beginTransaction(); try { //do something $transaction->commit(); } catch(Exception $e) { $transaction->rollBack(); if ($rethrow) throw $e; } } Now I understand you actually just want your wrapper to detect if a transaction is already in progress, and in this case not start the transaction. Therefore you do not really need the NestedPDO

Categories : Mysql

Why does setCustomAnimations persist even AFTER transactions in nested fragments
I'm not sure if this is the right approach. If anyone has better ideas, please let me know. The Fragment class has a field named mNextAnim for storing its animation IDs. // If app has requested a specific animation, this is the one to use. int mNextAnim; android.support.v4.app.BackStackRecord is the internal implementation class for FragmentTransaction. During transaction, it sets the mNextAnim field to the appropriate animation ID, but does not clear it afterwards. Field na = Fragment.class.getDeclaredField("mNextAnim"); na.setAccessible(true); na.set(fragF1, 0);

Categories : Android

Do PDO transactions block until all other transactions are committed?
As @eggyal pointed out, transactions can occur at the same time but a DELETE statment puts an exclusive lock on the row until the transaction is committed, so Transaction B will automatically block at step 4 until Transaction A is committed. An exclusive lock block all writes and also reads.

Categories : Mysql

"This version is not supported. only servers up to microsoft sql server 2005 are supported"
As Visual Studio 2008 was released before SQL Server 2008, the development environment database tools were coded without knowing about SQL Server 2008. However, since these versions of Visual Studio were released before SQL Server 2008, the design-time tools cannot interact with SQL Server 2008 - even though it is possible to programmatically access the data in a SQL Server 2008 database from applications written with Visual Studio 2008 or 2005 Source: Connecting to Microsoft SQL Server 2008 from Microsoft Visual Studio 2005 and 2008 Luckily, Microsoft did release a patch for both Visual Studio 2005 and Visual Studio 2008, which is also referenced in the article (to save you reading the whole thing, for Visual Studio 2008, you need to install Visual Studio 2008 Service Pack

Categories : Sql Server

Pitfalls of using SQL transactions vs .NET transactions
This is usually a design decision; where the logic of application housed. If you decide upon concentrating your business logic in the application code, for each atomic application logic which involves multiple trips to the database, you need to wrap that logic using transaction in C#. Whereas, if you house business logic in the database with the help of SPs, you do not need transaction in C#. A common scenario is: You create one or more records in the database. You do some post processing on this data in C#. You update another table with the data you just processed . The requirement is that if step 2 or 3 fails, step 1 (created records) should be rolled back. For this you need transactions. You may argue that you can put all the three steps in an SP and wrap it with a transaction; it

Categories : C#

Struts 1.1 nested and in combination
Use <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> and the code will look like <c:choose> <c:when test="${element.method1 == true}"> <c:choose> <c:when test="${element.method2 == true}"> <span style="color:green;"><c:out value="${element.prop1}/></span> </c:when> <c:otherwise> <span style="color:red;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose> </c:when> <c:otherwise> <span style="color:black;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose>

Categories : Java

Access SQL Transactions?
Transactions are not supported in MSAccess when you are using them in a query. Try firing a function to create those queries, which you can do in a module and have it run on PageLoad or even an OnTimer event. You can use the BeginTrans and Rollback commands inside the module.

Categories : SQL

Mongoose.js transactions
If you really must have transactions across multiple documents types (in separate collections) the means to achieve this is with a single table that stores actions to take. db.actions.insert( { actions: [{collection: 'players', _id: 'p1', update: {$set : {name : 'bob'} } }, {collection: 'stories', _id: 's1', update: {$set : {location: 'library'} } }], completed: false }, callback); This insert is atomic, and all done at once. You then can perform the commands in the 'actions' collection and mark them as complete or delete them as you complete them, calling your original callback when they are all completed. This only works if your actions processing loop is the only thing updating the db. Of course you'll have to stop using mongoose, but the sooner you do that the better you

Categories : Mongodb

PHP OOP script for transactions
I made 2 files: class.php and script.php class.php <?php class Transaction { protected $_transaction_called; protected $db; public function __construct(&$db) { $this->db = $db; $this->_transaction_called = false; } public function startTransaction() { if($this->_transaction_called == false) { $this->_transaction_called = true; mysql_query("START TRANSACTION", $this->db); } } public function stopTransaction($error) { if($this->_transaction_called == true) { $this->_transaction_called = false; if($error == true){ print "ROLLBACK "; mysql_query("ROLLBACK", $this->db); }else{

Categories : PHP

How is it possible to have deadlocks without transactions?
In InnoDB each statement is run in a transation; BEGIN and autocommit=0 are used for multi-statement transactions. Having said that, the deadlock happens between different transactions. It seems you don't have index on the id field, or more than one record have the same id. If not, than you have an index-gap locking in place. To diagnose further, you need to provide the output of SHOW ENGINE InnoDB STATUS

Categories : Mysql

Running everything using transactions in SQL
Long transaction are locking tables, so It's not preferable to do everything in transaction, especially very long running operations, because it can kill your database. for more info read this: http://simononsoftware.com/are-long-running-transactions-bad/

Categories : C#

When should I use MySQL transactions?
Transactions are used when you have a group of queries that all depend on one another. For example, a bank: Bank customer "John" transfers $100 to the account of "Alice". For this example, there are 2 queries (I'm not showing logging or transaction history...etc). You need to deduct $100 from John's balance and add that to Alice's balance. Start transaction Deduct from John UPDATE accounts SET balance=balance-100 WHERE account='John' Add to Alice UPDATE accounts SET balance=balance+100 WHERE account='Alice' commit A transaction isn't saved until you commit it. So if there was an error in either query, you could call rollback and undo any queries that have run since the transaction was started. If for some reason the query for adding $100 to Alice failed, you could rollback and not

Categories : PHP

Active transactions and PHP
It highly depends on your database engine, but usually once a transaction has been rolled back or committed, you will have to "create" a new one. A transaction is a "savepoint" within your database engine and should have no impact on your php code.

Categories : PHP

Using SQL transactions with C# in ASP website
You need to pass the transaction to the command before executing it: cmdCommand.Transaction = tran; Furthermore, you might want to be careful. You're using the transaction tran in the try block, but referencing it afterwards in the catch block. I would suggest moving the try/catch to inside the using(tran=...) block.

Categories : C#

Where session transactions are useful?
A transacted session allows you to do multiple things and for them to either all happen together, or not happen. A typical example might be you receive one message and send another one. JMS is considered a reliable transport, so assume that you want to ensure that the 2nd message is sent. If you do these things non-transacted and your processing application fails after the receive and before the send then you have lost information. To solve this problem you would make use of a transacted session. This would allow you to receive one message, send a second and then call Session.commit to make both occur at once.

Categories : Java

Filter transactions by department
There are several ways of doing this. I like the syntax of an OUTER JOIN / NULL check: select distinct t.userid from transactions t left join transactions t2 on t.userid = t2.userid and t2.department = 'Some Dept' where t2.userid is null DISTINCT may or may not be needed -- depends on your desired results. You could also use NOT IN (but I have seen performance issues in MySQL with this): select distinct userid from transactions where userid not in ( select userid from transactions where department = 'Some Dept')

Categories : PHP

Issues with concurrent Transactions
Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block You can't just continue after an error in PostgreSQL, you have to rollback and reissue the transaction. You, or the framework, are most likely swallowing a prior exception without handling it, so you incorrectly fail to roll back the aborted transaction. You or the framework you are using then try to run another statement on it, leading to the reported error. You need to find the previous error to determine the cause. If you can't figure it out at the Java level, enable statement logging in PostgreSQL and look at the PostgreSQL logs. What should be happening in this case is that Hibernate should be throwing an optimistic locking exception when you try

Categories : Java

Loggin' try-catch transactions
There is nothing essentially different inside try..catch blocks. And your file writing code should be working the same way as outside, no difference. The only issue I can think of is irrelevant to try..catch but to exceptions in general: a thrown exception terminates further code execution. Say, if there is an error in $stmt->rollBack(); - no code below will be executed. So, it's better to move a logger at the top of the block.

Categories : PHP

AMQP 1.0 and distributed transactions
Unfortunately you are correct in that the specification for AMQP 1.0 distributed transactions is not complete and consequently there is no support for distributed transactions over AMQP 1.0 in Apache Qpid or Azure Service Bus. Regards, Dave. (Service Bus team)

Categories : Misc

Locking table for more transactions
You can use DBMS_SCHEDULER: run jobs that load and transform the data turn off indexes run jobs that load data into DWH rebuild indexes Using Chains: http://docs.oracle.com/cd/B28359_01/server.111/b28310/scheduse009.htm#CHDCFBHG

Categories : SQL

Lazarus sqldb and Transactions
This is currently normal behaviour. I have planned an 'offline' mode where the transaction is closed but the data is kept open. What you can currently do is save the data to file (using the savetofile method), disconnect, and load the data again from file (using the loadfromfile method)

Categories : SQL

Ebay API: Get All Transactions By Seller
To get transactions for a user you should be first authorized by that user. You will need a developer account for that. This links will guide you http://developer.ebay.com/DevZone/XML/docs/WebHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=eBay_XML_API&file=GettingTokens-Getting_Tokens_for_Applications_with_Multiple_Users.html http://developer.ebay.com/DevZone/XML/docs/WebHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=eBay_XML_API&file=DevAndTestApplications-Testing_Applications.html Once you get the user token for a user you need to send them along with your developer credentials to make the getOrders API call for that particular user.

Categories : Api

Are transactions possible without @Version annotion
as i don't know the mondo driver, but have built entities with and without @Version, maybe a hint will help a bit: @Version is needed for optimistic locking. if no @Version field is contained in your beans you have to use pessimistic locking, because you can not detect concurrent changes. regards from germany, Thomas

Categories : Mongodb

Using Spring Transactions in MyBatis API
Did you have any return on that ? I'm wondering if in the doc they're talking about org.apache.ibatis.session.SqlSessionFactory from Mybatis-api while the SqlSessionFactory you're using is from the mybatis-spring lib : org.mybatis.spring.SqlSessionFactoryBean

Categories : Spring

Transactions and Events in Laravel 4
I had exactly the same question. Following the suggestion of @alexandre-danault, I can confirm that exceptions thrown within an event handler, where the event is fired from within a transaction, will cause the transaction to rollback. I figured putting this answer up might save you having to run your own test first. Here are my code snippets (I'm not using the closure form of transactions): // I throw an exception from within this event handler Event::listen('transaction.statusChange', 'TransactionHandler@onStatusChange'); // Here's the transaction that fires the event DB::beginTransaction(); try { $this->status = $status; if (!$this->save()){ throw new Exception('...'); } Event::fire('transaction.statusChange', ['transaction' => $this, 'status' => $

Categories : PHP

Duplicate error in transactions
Check if MachineNumber exists before attempting to update. You can use EXISTS or COUNT For instance: DECLARE @Exists INT SELECT @Exists = COUNT(MachineNumber) FROM TblProduces WHERE MachineNumber = @machinNum IF @Exists = 0 BEGIN -- Perform UPDATE END

Categories : SQL

Java "Aggregate" Transactions
There is Spring Transaction API framework which allows to aggregate transactions like this. However it doesn't help with partial commit because it is specific for the data sources you use. So the case when the part of the transaction has been committed and part is not will have to be handled in your code.

Categories : Java

Dependent transactions in hibernate
You can do that with one transaction as acdcjunior said. The Hibernate session waits to execute DML until the session commits (so it can reorder SQL actions) but you can tell it to go ahead and execute everything it has so far. The sequence number will be generated for you when the first insert executes. If you call flush on the current session after saving A, that will cause the insert SQL for A to be executed on the database (without committing the transaction). Then Hibernate will populate the key field on your A entity with the generated key value and you can use that to populate the FK field on the B entity. If you want to avoid going back to the database just to get a sequence number (which could get slow if you have a lot of inserts) then you may want to switch to a different seq

Categories : Java

Rhino Service Bus transactions
I posted the same issue on the Rhino Service Bus Google Groups site and got a response from Oren. It turns out that RSB will work with transactions, but I was using a IOnewayBus, which does not use DTC. I made the change to use a IStartableServiceBus and everything now works as I expected.

Categories : Dotnet

How to use MySQL transactions properly
Your best bet is to emulate nested transactions. To do this write a wrapper for your database access.(pseduocode) class MyMysqli { protected $realDb; protected $transaction_count =0; public function __construct ($host, $username , $passwd, $dbname){ $this->realDb = new Mysqli($host, $username, $passwd, $dbname); } public function __get($property){ return $this->realDb->$property; } public function __set($property, $value){ return $this->realDb->$property = $value; } public function __call($method, $args){ return call_user_func_array(array($this->realDb, $method), $args); } // overload begin_transaction, commit and rollback public function begin_transaction(){ $this->transactio

Categories : PHP

EJB transactions slowing down in one thread
I am sure that my suggestions might not be accurate one or you tried them already, but I'd like to give a try. As you mentioned that DB connection is bottleneck, I'll go after that. After reading the question, I find that time taken by transaction is proportional to iteration number. So it looks that entities created in first iteration are being sent to hibernate in next iteration. For example, in 4th iteration, entities created in 1st,2nd and 3rd iterations are also being sent for update or being sent to hibernate somehow. That could be the reason for degradation of performance as iteration progresses. As number of records to be updated/inserted/selected increases with each iteration. I can think of following possibilities on top of my head - Hibernate session used in first iterat

Categories : Performance

Entity Framework 5 without transactions
EF5 is hard-coded to wrap INSERTS and UPDATES into transactions. And in almost all cases, this is the desired behavior when batching writes of multiple entities. If you want to change that you will have to write new code for yourself, compile it to an appropriate DLL, and reference the new code instead. A lot of work to get around a very important safety feature. I don't recommend it. The question is why do you want to disable transactions so much? Is it causing performance problems? Do you find the extra safety of the transaction to be detrimental to the business process? It sounds like you don't care if writes are lost, phantom reads, etc. happen (which I assume because you are wanting to skip transactions all together), which is a bad idea. If that's not the case (I hope) and you'

Categories : Entity Framework

Implementing Transactions in mysql via php
$db->begin_transaction(); not $db->beginTransaction(); http://www.php.net/manual/en/mysqli.begin-transaction.php If earlier than PHP 5.5, then use $db->autocommit(true); instead

Categories : PHP

List of PayPal transactions
Check out the Instant Payment Notification documentation. You can specify a listener (such as a php script) that PayPal will POST the transaction information to after it has been completed, you can then store relevant transaction information yourself.

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.