Author: epbernard
Date: 2006-09-18 17:48:12 -0400 (Mon, 18 Sep 2006)
New Revision: 10492
Modified:
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java
Log:
more tests
Modified:
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java
===================================================================
---
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java 2006-09-17
21:05:01 UTC (rev 10491)
+++
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java 2006-09-18
21:48:12 UTC (rev 10492)
@@ -1,6 +1,7 @@
//$Id$
package org.hibernate.ejb.test.transaction;
+import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.LockModeType;
import javax.persistence.RollbackException;
@@ -182,6 +183,23 @@
em.close();
}
+ public void testTransactionCommitDoesNotFlush() throws Exception {
+ EntityManager em = factory.createEntityManager();
+ em.getTransaction().begin();
+ Book book = new Book();
+ book.name = "Java for Dummies";
+ em.persist( book );
+ em.getTransaction().commit();
+ em.close();
+ em = factory.createEntityManager();
+ em.getTransaction().begin();
+ List result = em.createQuery("select book from Book book where book.name =
:title").
+ setParameter( "title", book.name ).getResultList();
+ assertEquals( "EntityManager.commit() should trigger a flush()", 1,
result.size() );
+ em.getTransaction().commit();
+ em.close();
+ }
+
public void testRollbackOnlyOnPersistenceException() throws Exception {
Book book = new Book();
book.name = "Stolen keys";
Show replies by date