Test « Transaction « JPA Q&A





1. jpa2 hibernate, a testcase to test lock over an entity    stackoverflow.com

I'm using Hibernate 3.5.5.Final and JPA2 How can make a testcase to test if the hibernate lock is working? I wrote this, but seems that the test not pass in the current hibernate ...

2. Rollback comitted changes for system testing    forum.hibernate.org

Our system under test uses Hibernate for persistence. We do automated system tests and want to put the database in the same condition before each test is run. Currently we use some Oracle triggers and procedures to reset Insert statements. But it cannot handle Updates and Deletes. Is there already a solution for this inside Hibernate for this? We need to ...

3. Relatively simple test case to force deadlock?    forum.hibernate.org

So our object model is getting moderately complex and yesterday I saw our first (non-easily-reproducible, timing-dependent) database deadlock. I'm a relative database newbie, so while I understand (I believe) the basic concepts behind row-level locking and Hibernate's use of locking, I would like to get more clarity on exactly when deadlock scenarios happen and what kinds of lock reordering will likely ...

4. Testing JTA Transaction Rollback    forum.hibernate.org

Customer ctmr = new Customer("John", "Doe"); ctmr.setcid(1); //Set customer ID Fintrans fts = new Fintrans(); fts.setAmountWillingToPay(12000.05); fts.setCustomer(ctmr); fts.setDatetime("06/22/2006"); fts.setGrandTotalAccrued(3213.20); fts.setGrandTotalPaid(13651.10); fts.setReason("No reason given"); UserTransaction tx = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction"); try{ tx.begin(); factory.getCurrentSession().save(fts); tx.commit(); }catch(Exception e){ if (tx != null) ...

5. Testing JTA Transaction Rollback    forum.hibernate.org

Customer ctmr = new Customer("John", "Doe"); ctmr.setcid(1); //Set customer ID Fintrans fts = new Fintrans(); fts.setAmountWillingToPay(12000.05); fts.setCustomer(ctmr); fts.setDatetime("06/22/2006"); fts.setGrandTotalAccrued(3213.20); fts.setGrandTotalPaid(13651.10); fts.setReason("No reason given"); UserTransaction tx = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction"); try{ tx.begin(); factory.getCurrentSession().save(fts); tx.commit(); }catch(Exception e){ if (tx != null) ...

6. Testing JTA Transaction Rollback    forum.hibernate.org

I have the following code to test whether a JTA Transaction really can rollback: Code: Customer ctmr = new Customer("John", "Doe"); ctmr.setcid(1); //Set customer ID Fintrans fts = new Fintrans(); fts.setAmountWillingToPay(12000.05); fts.setCustomer(ctmr); fts.setDatetime("06/22/2006"); fts.setGrandTotalAccrued(3213.20); fts.setGrandTotalPaid(13651.10); fts.setReason("No reason given"); Transaction tx = null; try{ tx = factory.openSession().beginTransaction(); ...

7. Test lock    forum.hibernate.org

Think this a very simple question, but i couldn't found any satisfying answer yet. Lets says that a Thread put a lock on a given row of a table ( using session.lock(myObj, LockMode.UPGRADE for example ). How can i test, in another thread, ( or a complete other application that connects to the same database ) whether that row ( let's ...

8. How to wire transactions for FitNesse tests?    forum.hibernate.org

Hi Are using FitNesse for testing an application. I have problems running a fixture (extending columnfixture). I cannot find how to start a transaction in the fixture, and therefore get an exception saying "no session bound to thread". My aplication uses Spring annotation driven tx-controls and an hibernatetransactionmanager. Has anyone some good tips on how to wire transactions with hibernate, fitnesse ...