This is an automated email from the ASF dual-hosted git repository. struberg pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openjpa.git
commit 362474e5c93fc0dd73907e16929f55450d9d92e1 Author: Mark Struberg <[email protected]> AuthorDate: Fri Jan 25 21:37:16 2019 +0100 OPENJPA-2713 add java8 time support for MySQL and MariaDB --- .../java/org/apache/openjpa/jdbc/sql/MariaDBDictionary.java | 12 +++++++++++- .../java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java | 13 ++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MariaDBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MariaDBDictionary.java index be9b51d..106bc5b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MariaDBDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MariaDBDictionary.java @@ -344,8 +344,18 @@ public class MariaDBDictionary extends DBDictionary { @Override public int getPreferredType(int type) { - if (type == Types.CLOB && !useClobs) + if (type == Types.CLOB && !useClobs) { return Types.LONGVARCHAR; + } + else if (type == Types.TIME_WITH_TIMEZONE) { + // MariaDB doesn't support SQL-2003 'WITH TIMEZONE' nor the respective JDBC types. + return Types.TIME; + } + else if (type == Types.TIMESTAMP_WITH_TIMEZONE) { + // MariaDB doesn't support SQL-2003 'WITH TIMEZONE' nor the respective JDBC types. + return Types.TIMESTAMP; + } + return super.getPreferredType(type); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java index 4d061f2..ccd63d4 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java @@ -366,11 +366,22 @@ public class MySQLDictionary @Override public int getPreferredType(int type) { - if (type == Types.CLOB && !useClobs) + if (type == Types.CLOB && !useClobs) { return Types.LONGVARCHAR; + } + else if (type == Types.TIME_WITH_TIMEZONE) { + // MySQL doesn't support SQL-2003 'WITH TIMEZONE' nor the respective JDBC types. + return Types.TIME; + } + else if (type == Types.TIMESTAMP_WITH_TIMEZONE) { + // MySQL doesn't support SQL-2003 'WITH TIMEZONE' nor the respective JDBC types. + return Types.TIMESTAMP; + } + return super.getPreferredType(type); } + /** * Append XML comparison. *
