From f68d08abc1d392337553072c362efcd488f15c33 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Wed, 19 Sep 2018 23:37:30 +0200 Subject: [PATCH] HHH-10148 - SpatialDialect for SqlServer2012 --- .../db2/resources/hibernate.properties | 2 +- .../mysql56/resources/hibernate.properties | 2 +- .../matrix.gradle | 2 +- .../mysql8/resources/hibernate.properties | 25 ++++ .../matrix.gradle | 2 +- .../resources/hibernate.properties | 2 +- .../matrix.gradle | 2 +- .../resources/hibernate.properties | 2 +- .../oracle12c_spatial_native/matrix.gradle | 8 ++ .../resources/hibernate.properties | 2 +- .../matrix.gradle | 0 .../resources/hibernate.properties | 6 +- .../resources/hibernate.properties | 2 +- .../sqlserver2012_spatial/matrix.gradle | 11 ++ .../resources/hibernate.properties | 23 ++++ hibernate-spatial/scripts/build-docker-db2.sh | 78 +++++++++++ hibernate-spatial/scripts/db2_11_env | 15 +++ .../SqlServer2008SpatialDialect.java | 124 +++--------------- .../SqlServer2012SpatialDialect.java | 80 +++++++++++ .../dialect/sqlserver/SqlServerFunctions.java | 60 +++++++++ .../dialect/sqlserver/SqlServerSupport.java | 111 ++++++++++++++++ .../spatial/testing/TestSupportFactories.java | 3 + 22 files changed, 445 insertions(+), 117 deletions(-) rename hibernate-spatial/databases/{oracle11g_connection_finder => mysql8}/matrix.gradle (82%) create mode 100644 hibernate-spatial/databases/mysql8/resources/hibernate.properties rename hibernate-spatial/databases/{oracle11g_spatial_native => oracle12c_connection_finder}/matrix.gradle (82%) rename hibernate-spatial/databases/{oracle11g_connection_finder => oracle12c_connection_finder}/resources/hibernate.properties (92%) rename hibernate-spatial/databases/{oracle11g_spatial => oracle12c_spatial}/matrix.gradle (82%) rename hibernate-spatial/databases/{oracle11g_spatial => oracle12c_spatial}/resources/hibernate.properties (92%) create mode 100644 hibernate-spatial/databases/oracle12c_spatial_native/matrix.gradle rename hibernate-spatial/databases/{oracle11g_spatial_native => oracle12c_spatial_native}/resources/hibernate.properties (92%) rename hibernate-spatial/databases/{postgispg95 => postgispg96}/matrix.gradle (100%) rename hibernate-spatial/databases/{postgispg95 => postgispg96}/resources/hibernate.properties (77%) create mode 100644 hibernate-spatial/databases/sqlserver2012_spatial/matrix.gradle create mode 100644 hibernate-spatial/databases/sqlserver2012_spatial/resources/hibernate.properties create mode 100755 hibernate-spatial/scripts/build-docker-db2.sh create mode 100644 hibernate-spatial/scripts/db2_11_env create mode 100644 hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/sqlserver/SqlServer2012SpatialDialect.java create mode 100644 hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/sqlserver/SqlServerFunctions.java create mode 100644 hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/sqlserver/SqlServerSupport.java diff --git a/hibernate-spatial/databases/db2/resources/hibernate.properties b/hibernate-spatial/databases/db2/resources/hibernate.properties index d9db7f9156..dd6ec8b7a7 100644 --- a/hibernate-spatial/databases/db2/resources/hibernate.properties +++ b/hibernate-spatial/databases/db2/resources/hibernate.properties @@ -10,7 +10,7 @@ hibernate.dialect org.hibernate.spatial.dialect.db2.DB2SpatialDialect hibernate.connection.driver_class com.ibm.db2.jcc.DB2Driver hibernate.connection.url jdbc:db2://localhost:50000/hibern8 hibernate.connection.username db2inst1 -hibernate.connection.password dbinst1-pwd +hibernate.connection.password password hibernate.connection.pool_size 5 diff --git a/hibernate-spatial/databases/mysql56/resources/hibernate.properties b/hibernate-spatial/databases/mysql56/resources/hibernate.properties index 89fbb1616e..b5383e0260 100644 --- a/hibernate-spatial/databases/mysql56/resources/hibernate.properties +++ b/hibernate-spatial/databases/mysql56/resources/hibernate.properties @@ -7,7 +7,7 @@ hibernate.dialect org.hibernate.spatial.dialect.mysql.MySQL56SpatialDialect hibernate.connection.driver_class com.mysql.jdbc.Driver -hibernate.connection.url jdbc:mysql://hibern8.cctaez8ywvn2.eu-west-1.rds.amazonaws.com:3306/hibernate_orm_test +hibernate.connection.url jdbc:mysql://localhost:3306/hibern8 hibernate.connection.username hibernateormtest hibernate.connection.password hibernateormtest diff --git a/hibernate-spatial/databases/oracle11g_connection_finder/matrix.gradle b/hibernate-spatial/databases/mysql8/matrix.gradle similarity index 82% rename from hibernate-spatial/databases/oracle11g_connection_finder/matrix.gradle rename to hibernate-spatial/databases/mysql8/matrix.gradle index 3a4d4751a6..8ddca02827 100644 --- a/hibernate-spatial/databases/oracle11g_connection_finder/matrix.gradle +++ b/hibernate-spatial/databases/mysql8/matrix.gradle @@ -4,4 +4,4 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -jdbcDependency "com.oracle.jdbc:ojdbc6:11.1.0.7.0" +jdbcDependency "mysql:mysql-connector-java:8.0.12" diff --git a/hibernate-spatial/databases/mysql8/resources/hibernate.properties b/hibernate-spatial/databases/mysql8/resources/hibernate.properties new file mode 100644 index 0000000000..b5383e0260 --- /dev/null +++ b/hibernate-spatial/databases/mysql8/resources/hibernate.properties @@ -0,0 +1,25 @@ +# +# Hibernate, Relational Persistence for Idiomatic Java +# +# License: GNU Lesser General Public License (LGPL), version 2.1 or later. +# See the lgpl.txt file in the root directory or . +# + +hibernate.dialect org.hibernate.spatial.dialect.mysql.MySQL56SpatialDialect +hibernate.connection.driver_class com.mysql.jdbc.Driver +hibernate.connection.url jdbc:mysql://localhost:3306/hibern8 +hibernate.connection.username hibernateormtest +hibernate.connection.password hibernateormtest + + +hibernate.connection.pool_size 5 + +hibernate.show_sql true +hibernate.format_sql true + +hibernate.max_fetch_depth 5 + +hibernate.cache.region_prefix hibernate.test +hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory + + diff --git a/hibernate-spatial/databases/oracle11g_spatial_native/matrix.gradle b/hibernate-spatial/databases/oracle12c_connection_finder/matrix.gradle similarity index 82% rename from hibernate-spatial/databases/oracle11g_spatial_native/matrix.gradle rename to hibernate-spatial/databases/oracle12c_connection_finder/matrix.gradle index 3a4d4751a6..b07891d83c 100644 --- a/hibernate-spatial/databases/oracle11g_spatial_native/matrix.gradle +++ b/hibernate-spatial/databases/oracle12c_connection_finder/matrix.gradle @@ -4,4 +4,4 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -jdbcDependency "com.oracle.jdbc:ojdbc6:11.1.0.7.0" +jdbcDependency "com.oracle:ojdbc7:12.1.0.2.0" diff --git a/hibernate-spatial/databases/oracle11g_connection_finder/resources/hibernate.properties b/hibernate-spatial/databases/oracle12c_connection_finder/resources/hibernate.properties similarity index 92% rename from hibernate-spatial/databases/oracle11g_connection_finder/resources/hibernate.properties rename to hibernate-spatial/databases/oracle12c_connection_finder/resources/hibernate.properties index 896e19f4be..cd5168ec01 100644 --- a/hibernate-spatial/databases/oracle11g_connection_finder/resources/hibernate.properties +++ b/hibernate-spatial/databases/oracle12c_connection_finder/resources/hibernate.properties @@ -7,7 +7,7 @@ hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver -hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c +hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB hibernate.connection.username C##hibernate hibernate.connection.password hibernate diff --git a/hibernate-spatial/databases/oracle11g_spatial/matrix.gradle b/hibernate-spatial/databases/oracle12c_spatial/matrix.gradle similarity index 82% rename from hibernate-spatial/databases/oracle11g_spatial/matrix.gradle rename to hibernate-spatial/databases/oracle12c_spatial/matrix.gradle index 3a4d4751a6..b07891d83c 100644 --- a/hibernate-spatial/databases/oracle11g_spatial/matrix.gradle +++ b/hibernate-spatial/databases/oracle12c_spatial/matrix.gradle @@ -4,4 +4,4 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -jdbcDependency "com.oracle.jdbc:ojdbc6:11.1.0.7.0" +jdbcDependency "com.oracle:ojdbc7:12.1.0.2.0" diff --git a/hibernate-spatial/databases/oracle11g_spatial/resources/hibernate.properties b/hibernate-spatial/databases/oracle12c_spatial/resources/hibernate.properties similarity index 92% rename from hibernate-spatial/databases/oracle11g_spatial/resources/hibernate.properties rename to hibernate-spatial/databases/oracle12c_spatial/resources/hibernate.properties index ce393e415d..4a9b1af111 100644 --- a/hibernate-spatial/databases/oracle11g_spatial/resources/hibernate.properties +++ b/hibernate-spatial/databases/oracle12c_spatial/resources/hibernate.properties @@ -7,7 +7,7 @@ hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver -hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c +hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB hibernate.connection.username C##hibernate hibernate.connection.password hibernate diff --git a/hibernate-spatial/databases/oracle12c_spatial_native/matrix.gradle b/hibernate-spatial/databases/oracle12c_spatial_native/matrix.gradle new file mode 100644 index 0000000000..dcec16a822 --- /dev/null +++ b/hibernate-spatial/databases/oracle12c_spatial_native/matrix.gradle @@ -0,0 +1,8 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +jdbcDependency "com.oracle:ojdbc7:12.1.0.2.0" + diff --git a/hibernate-spatial/databases/oracle11g_spatial_native/resources/hibernate.properties b/hibernate-spatial/databases/oracle12c_spatial_native/resources/hibernate.properties similarity index 92% rename from hibernate-spatial/databases/oracle11g_spatial_native/resources/hibernate.properties rename to hibernate-spatial/databases/oracle12c_spatial_native/resources/hibernate.properties index d693a419b2..15cfa9e970 100644 --- a/hibernate-spatial/databases/oracle11g_spatial_native/resources/hibernate.properties +++ b/hibernate-spatial/databases/oracle12c_spatial_native/resources/hibernate.properties @@ -7,7 +7,7 @@ hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatialSDO10gDialect hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver -hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c +hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB hibernate.connection.username C##hibernate hibernate.connection.password hibernate diff --git a/hibernate-spatial/databases/postgispg95/matrix.gradle b/hibernate-spatial/databases/postgispg96/matrix.gradle similarity index 100% rename from hibernate-spatial/databases/postgispg95/matrix.gradle rename to hibernate-spatial/databases/postgispg96/matrix.gradle diff --git a/hibernate-spatial/databases/postgispg95/resources/hibernate.properties b/hibernate-spatial/databases/postgispg96/resources/hibernate.properties similarity index 77% rename from hibernate-spatial/databases/postgispg95/resources/hibernate.properties rename to hibernate-spatial/databases/postgispg96/resources/hibernate.properties index d35e2cf8fc..7071e5a31e 100644 --- a/hibernate-spatial/databases/postgispg95/resources/hibernate.properties +++ b/hibernate-spatial/databases/postgispg96/resources/hibernate.properties @@ -8,9 +8,9 @@ hibernate.test.new_metadata_mappings = true hibernate.dialect org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect hibernate.connection.driver_class org.postgresql.Driver -hibernate.connection.url jdbc:postgresql://hbpg96.cctaez8ywvn2.eu-west-1.rds.amazonaws.com:5432/hibernate -hibernate.connection.username hibbrtru -hibernate.connection.password QilTygcxHwk1 +hibernate.connection.url jdbc:postgresql://localhost:9432 +hibernate.connection.username hibern8 +hibernate.connection.password hibern8 hibernate.connection.pool_size 5 diff --git a/hibernate-spatial/databases/sqlserver2008_spatial/resources/hibernate.properties b/hibernate-spatial/databases/sqlserver2008_spatial/resources/hibernate.properties index f0d3ef1c58..0dd46f3396 100644 --- a/hibernate-spatial/databases/sqlserver2008_spatial/resources/hibernate.properties +++ b/hibernate-spatial/databases/sqlserver2008_spatial/resources/hibernate.properties @@ -9,7 +9,7 @@ hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDi hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver hibernate.connection.url jdbc:sqlserver://localhost:1433;databaseName=TestDb hibernate.connection.username hibern8 -hibernate.connection.password hibern8Pass +hibernate.connection.password langpaswoord123A%1 hibernate.connection.pool_size 5 diff --git a/hibernate-spatial/databases/sqlserver2012_spatial/matrix.gradle b/hibernate-spatial/databases/sqlserver2012_spatial/matrix.gradle new file mode 100644 index 0000000000..21ac5e6da1 --- /dev/null +++ b/hibernate-spatial/databases/sqlserver2012_spatial/matrix.gradle @@ -0,0 +1,11 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +repositories { + mavenLocal( ) +} + +jdbcDependency 'com.microsoft.sqlserver:mssql-jdbc:6.4.0.jre8' diff --git a/hibernate-spatial/databases/sqlserver2012_spatial/resources/hibernate.properties b/hibernate-spatial/databases/sqlserver2012_spatial/resources/hibernate.properties new file mode 100644 index 0000000000..741dbcb220 --- /dev/null +++ b/hibernate-spatial/databases/sqlserver2012_spatial/resources/hibernate.properties @@ -0,0 +1,23 @@ +# +# Hibernate, Relational Persistence for Idiomatic Java +# +# License: GNU Lesser General Public License (LGPL), version 2.1 or later. +# See the lgpl.txt file in the root directory or . +# + +hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2012SpatialDialect +hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver +hibernate.connection.url jdbc:sqlserver://localhost:1433;databaseName=TestDb +hibernate.connection.username hibern8 +hibernate.connection.password hibern8Pass + + +hibernate.connection.pool_size 5 + +hibernate.show_sql true +hibernate.format_sql true + +hibernate.max_fetch_depth 5 + +hibernate.cache.region_prefix hibernate.test +hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory diff --git a/hibernate-spatial/scripts/build-docker-db2.sh b/hibernate-spatial/scripts/build-docker-db2.sh new file mode 100755 index 0000000000..cabc57352a --- /dev/null +++ b/hibernate-spatial/scripts/build-docker-db2.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +WD=$(dirname $0) + +docker run -h db2server_db2_22 \ + --name db2_11 \ + -p 50000:50000 -p 55000:55000\ + --privileged=true \ + --env-file db2_11_env \ + -v ${WD}/../../../hibernate-spatial-docker-dbs/db2_11 \ + --detach ibmcom/db2express-c:latest + +#The followin steps need to be executed +#(This will need to end up in a script) +# +## First connect to the docker and switch to user db2inst +# docker exec -i -t db2 /bin/bash +# +# su - db2inst1 + +# +## create the database with 8K pagesize , connect to it and enable +# +#db2 create database hibern8 pagesize 8 k + +#db2 connect to hibern8 + +#db2se enable_db hibern8 + +## generate the ewkt.sql script: +#cat > ewkt.sql <