summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2009-01-29 10:34:47 (EST)
committerStefan Winkler2009-01-29 10:34:47 (EST)
commitb0af4ef45c819bbea1d04f47e4e683ecfbc35890 (patch)
treeaccd9b5e434cb27079aac10365e3c1c5de08e49b
parentba1898316901bb17715c6eeb1d2608df56627f0c (diff)
downloadcdo-b0af4ef45c819bbea1d04f47e4e683ecfbc35890.zip
cdo-b0af4ef45c819bbea1d04f47e4e683ecfbc35890.tar.gz
cdo-b0af4ef45c819bbea1d04f47e4e683ecfbc35890.tar.bz2
[217255] [DB] DBStore does not store Date type correctly
https://bugs.eclipse.org/bugs/show_bug.cgi?id=217255 (Fix for prepared statements)
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/PreparedStatementJDBCDelegate.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/PreparedStatementJDBCDelegate.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/PreparedStatementJDBCDelegate.java
index d64654d..f43475b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/PreparedStatementJDBCDelegate.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/PreparedStatementJDBCDelegate.java
@@ -31,7 +31,9 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.sql.Timestamp;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -328,6 +330,11 @@ public class PreparedStatementJDBCDelegate extends AbstractJDBCDelegate
{
stmt.setNull(col++, attributeMapping.getField().getType().getCode());
}
+ else if (value instanceof java.util.Date)
+ {
+ // BUG 217255
+ stmt.setTimestamp(col++, new Timestamp(((Date)value).getTime()));
+ }
else
{
stmt.setObject(col++, value);