openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r1097160 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
Date Wed, 27 Apr 2011 16:00:37 GMT
Author: mikedd
Date: Wed Apr 27 16:00:37 2011
New Revision: 1097160

URL: http://svn.apache.org/viewvc?rev=1097160&view=rev
Log:
OPENJPA-1985: Check for abstime as a timestamp type for Postgres

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java?rev=1097160&r1=1097159&r2=1097160&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
Wed Apr 27 16:00:37 2011
@@ -37,7 +37,9 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.openjpa.jdbc.identifier.DBIdentifier;
 import org.apache.openjpa.jdbc.identifier.Normalizer;
@@ -74,6 +76,8 @@ public class PostgresDictionary
 
     private Method dbcpGetDelegate;
     private Method connectionUnwrap;
+    
+    protected Set<String> _timestampTypes = new HashSet<String>(); 
 
     static {
         try {
@@ -219,6 +223,10 @@ public class PostgresDictionary
             "THEN", "TO", "TRAILING", "TRUE", "UNION", "UNIQUE", "USER", 
             "USING", "VERBOSE", "WHEN", "WHERE",
         }));
+        
+        _timestampTypes.add("ABSTIME");
+        _timestampTypes.add("TIMESTAMP");
+        _timestampTypes.add(timestampTypeName.toUpperCase()); // handle user configured timestamp
types.
     }
 
     @Override
@@ -783,7 +791,7 @@ public class PostgresDictionary
             try {
                 Method m = obj.getClass().getMethod("getType", (Class[]) null);
                 Object type = m.invoke(obj, (Object[]) null);
-                if (((String) type).equalsIgnoreCase(timestampTypeName)) {
+                if(_timestampTypes.contains(((String) type).toUpperCase())) { 
                     return rs.getTimestamp(column);
                 }
             } catch (Throwable t) {
@@ -1024,3 +1032,4 @@ public class PostgresDictionary
         }
     }
 }
+



Mime
View raw message