openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r932662 - /openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestJDBCEscapeDate.java
Date Sat, 10 Apr 2010 02:31:05 GMT
Author: dwoods
Date: Sat Apr 10 02:31:05 2010
New Revision: 932662

URL: http://svn.apache.org/viewvc?rev=932662&view=rev
Log:
OPENJPA-1620 Fix TestJDBCEscapeDate test for HSQLDB.  Merged in from trunk r932191.

Modified:
    openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestJDBCEscapeDate.java

Modified: openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestJDBCEscapeDate.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestJDBCEscapeDate.java?rev=932662&r1=932661&r2=932662&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestJDBCEscapeDate.java
(original)
+++ openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestJDBCEscapeDate.java
Sat Apr 10 02:31:05 2010
@@ -28,6 +28,8 @@ import javax.persistence.Query;
 import junit.framework.Assert;
 
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.HSQLDictionary;
 import org.apache.openjpa.jdbc.sql.SQLServerDictionary;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
@@ -56,9 +58,10 @@ public class TestJDBCEscapeDate extends 
         em.clear();
 
         String[] jpql;
-        if (((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance() instanceof
SQLServerDictionary){
+        DBDictionary dict = ((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance();
+        if ((dict instanceof SQLServerDictionary) || (dict instanceof HSQLDictionary)) {
             jpql = new String[] {
-                // some changes to the jpql strings had to be made for MSSQL
+                // some changes to the jpql strings had to be made for MSSQL and HSQLDB
                 "select a from Employee a where a.hireDate >= {d '2009-08-25'}",
                 "select a from Employee a where a.hireDate >= {d '2009-08-05'}",    //
requires yyyy-mm-dd
                 // "select a from Employee a where a.hireTime >= {t '00:00:00'}",   //
fails ?
@@ -110,8 +113,8 @@ public class TestJDBCEscapeDate extends 
         }
         em.getTransaction().begin();
         String update;
-        if (((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance() instanceof
SQLServerDictionary) {
-            // more than 3 digits after 00:00:00. fails on MSSQL
+        if ((dict instanceof SQLServerDictionary) || (dict instanceof HSQLDictionary)) {
+            // more than 3 digits after 00:00:00. fails on MSSQL and HSQLDB
             update = "update Employee a set a.hireTimestamp = {ts '2009-08-25 00:00:00.123'}
where a.empId = 1";
         } else {
             update = "update Employee a set a.hireTimestamp = {ts '2009-08-25 00:00:00.123456'}
where a.empId = 1";



Mime
View raw message