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 ad4ed02728a9bbb1624f490bf6eabd59922981a9 Author: Mark Struberg <[email protected]> AuthorDate: Wed Jan 30 22:33:08 2019 +0100 OPENJPA-2713 fix h2 --- .../org/apache/openjpa/jdbc/sql/DBDictionary.java | 3 +++ .../org/apache/openjpa/jdbc/sql/H2Dictionary.java | 3 +++ openjpa-project/BUILDING.txt | 6 ++--- pom.xml | 27 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java index f9bc575..a0ad2ba 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java @@ -4755,6 +4755,9 @@ public class DBDictionary * from {@link DatabaseMetaData}. */ protected String getTableNameForMetadata(DBIdentifier tableName) { + if (tableName == null) { + return null; + } return convertSchemaCase(tableName.getUnqualifiedName()); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/H2Dictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/H2Dictionary.java index af1871e..a6f1e79 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/H2Dictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/H2Dictionary.java @@ -69,6 +69,9 @@ public class H2Dictionary extends DBDictionary { supportsLockingWithOuterJoin = false; supportsLockingWithInnerJoin = false; + // no timezone support for time in h2 + timeWithZoneTypeName = "TIME"; + reservedWordSet.addAll(Arrays.asList(new String[] { "CURRENT_TIMESTAMP", "CURRENT_TIME", "CURRENT_DATE", "CROSS", "DISTINCT", "EXCEPT", "EXISTS", "FROM", "FOR", "FALSE", "FULL", diff --git a/openjpa-project/BUILDING.txt b/openjpa-project/BUILDING.txt index 351d380..c973078 100644 --- a/openjpa-project/BUILDING.txt +++ b/openjpa-project/BUILDING.txt @@ -198,17 +198,17 @@ To run the tests in the debugger simply add the following JVM properties -Dopenjpa.ConnectionURL=jdbc:derby:target/database/openjpa-derby-database;create=true -Dopenjpa.ConnectionDriverName=org.apache.derby.jdbc.EmbeddedDriver For running against a MySQL Docker installation: - -ea -Dopenjpa.ConnectionDriverName=com.mysql.jdbc.Driver -Dopenjpa.ConnectionURL=jdbc:mysql://localhost:3306/openjpatst -Dopenjpa.ConnectionUserName=openjpatst -Dopenjpa.ConnectionPassword=openjpatst Running against a PostgreSQL Docker installation: - -ea -Dopenjpa.ConnectionDriverName=org.postgresql.Driver -Dopenjpa.ConnectionURL=jdbc:postgresql:5432//localhost/openjpatst -Dopenjpa.ConnectionUserName=postgres -Dopenjpa.ConnectionPassword=postgres For running against a MariaDB Docker installation: - -ea -Dopenjpa.ConnectionDriverName=org.mariadb.jdbc.Driver -Dopenjpa.ConnectionURL=jdbc:mariadb://localhost:3306/openjpatst -Dopenjpa.ConnectionUserName=root -Dopenjpa.ConnectionPassword=openjpatst +For running against a h2 based installation: + -ea -Dopenjpa.ConnectionDriverName=org.h2.Driver -Dopenjpa.ConnectionURL=jdbc:h2:./target/database/openjpa-h2-database -Dopenjpa.ConnectionUserName=root -Dopenjpa.ConnectionPassword=openjpatst + TODO: finish! For starting tests in `openjpa-persistence-jdbc` inside a compiler you can also trigger all the enhancement manually via: diff --git a/pom.xml b/pom.xml index 7a44eba..45bb243 100644 --- a/pom.xml +++ b/pom.xml @@ -430,6 +430,33 @@ </properties> </profile> + <!-- profile for testing with an embedded h2 DB --> + <profile> + <id>test-h2</id> + <activation> + <property> + <name>test-h2</name> + </property> + </activation> + <properties> + <h2.version>1.4.197</h2.version> + <connection.driver.name>org.h2.Driver</connection.driver.name> + <connection.url>jdbc:h2:./target/database/openjpa-h2-database</connection.url> + <connection.username /> + <connection.password /> + <!-- TCK specific properties --> + <tck.db.name>h2mem</tck.db.name> + </properties> + + <dependencies> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>${h2.version}</version> + </dependency> + </dependencies> + </profile> + <!-- Profile for testing with an In-Memory Apache Derby DB --> <profile> <!--
