From 57442b70592e83218b1d9ac78c972364308e20d1 Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Thu, 5 Apr 2007 23:57:44 +0000 Subject: [PATCH] HSQL doesn't support locking; short-circuiting tests that require pessimistic locking git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@526005 13f79535-47bb-0310-9956-ffa450edef68 --- .../jdbc/TestIsolationLevelOverride.java | 6 ++++++ .../jdbc/TestSelectForUpdateOverride.java | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestIsolationLevelOverride.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestIsolationLevelOverride.java index 396e4d753..692ebcef4 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestIsolationLevelOverride.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestIsolationLevelOverride.java @@ -27,6 +27,7 @@ import org.apache.openjpa.persistence.FetchPlan; import org.apache.openjpa.persistence.OpenJPAEntityManager; import org.apache.openjpa.jdbc.sql.DBDictionary; import org.apache.openjpa.jdbc.sql.DB2Dictionary; +import org.apache.openjpa.jdbc.sql.HSQLDictionary; import org.apache.openjpa.jdbc.conf.JDBCConfiguration; public class TestIsolationLevelOverride @@ -43,6 +44,11 @@ public class TestIsolationLevelOverride OpenJPAPersistence.cast(emf.createEntityManager()); DBDictionary dict = ((JDBCConfiguration) em.getConfiguration()) .getDBDictionaryInstance(); + + // hsql doesn't support locking; circumvent the test + if (dict instanceof HSQLDictionary) + return; + sql.clear(); try { em.getTransaction().begin(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestSelectForUpdateOverride.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestSelectForUpdateOverride.java index 1c670f453..d04d6011e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestSelectForUpdateOverride.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestSelectForUpdateOverride.java @@ -22,6 +22,10 @@ import org.apache.openjpa.persistence.test.SQLListenerTestCase; import org.apache.openjpa.persistence.simple.AllFieldTypes; import org.apache.openjpa.persistence.OpenJPAPersistence; import org.apache.openjpa.persistence.FetchPlan; +import org.apache.openjpa.persistence.OpenJPAEntityManager; +import org.apache.openjpa.jdbc.sql.DBDictionary; +import org.apache.openjpa.jdbc.sql.HSQLDictionary; +import org.apache.openjpa.jdbc.conf.JDBCConfiguration; public class TestSelectForUpdateOverride extends SQLListenerTestCase { @@ -34,7 +38,15 @@ public class TestSelectForUpdateOverride } public void testSelectForUpdateOverride() { - EntityManager em = emf.createEntityManager(); + OpenJPAEntityManager em = + OpenJPAPersistence.cast(emf.createEntityManager()); + DBDictionary dict = ((JDBCConfiguration) em.getConfiguration()) + .getDBDictionaryInstance(); + + // hsql doesn't support locking; circumvent the test + if (dict instanceof HSQLDictionary) + return; + sql.clear(); try { em.getTransaction().begin();