aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r1738124 - /aries/trunk/tx-control/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java
Date Thu, 07 Apr 2016 12:31:24 GMT
Author: timothyjward
Date: Thu Apr  7 12:31:23 2016
New Revision: 1738124

URL: http://svn.apache.org/viewvc?rev=1738124&view=rev
Log:
[tx-control] Avoid teardown exception when using Hibernate

Modified:
    aries/trunk/tx-control/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java

Modified: aries/trunk/tx-control/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java?rev=1738124&r1=1738123&r2=1738124&view=diff
==============================================================================
--- aries/trunk/tx-control/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java
(original)
+++ aries/trunk/tx-control/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java
Thu Apr  7 12:31:23 2016
@@ -30,6 +30,8 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 
 import javax.persistence.EntityManager;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaDelete;
 
 import org.apache.aries.itest.AbstractIntegrationTest;
 import org.apache.aries.tx.control.itests.entity.Message;
@@ -119,9 +121,12 @@ public abstract class AbstractJPATransac
 
 		try {
 			txControl.required(() -> 
-				em.createQuery(
-						em.getCriteriaBuilder().createCriteriaDelete(Message.class)
-				).executeUpdate());
+				{
+					CriteriaBuilder cb = em.getCriteriaBuilder();
+					CriteriaDelete<Message> delete = cb.createCriteriaDelete(Message.class);
+					delete.from(Message.class);
+					return em.createQuery(delete).executeUpdate();
+				});
 		} catch (Exception e) {
 			e.printStackTrace();
 		}



Mime
View raw message