Closed abcfy2 closed 6 years ago
There's a PR about it, but I'm not sure about its status: #110
I've tried to upgrade grails to 3.3.5
because grails 3.3
has been supported hibernate 5.2
. And I can compile this extension, but all of the testings are failed. Would you please give me a help ?
Here is my git diff
patch from master branch:
diff --git a/build.gradle b/build.gradle
index 220a97b..43c652a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,27 +10,23 @@ buildscript {
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
- classpath "org.grails.plugins:hibernate5:$gormVersion"
+ classpath "org.grails.plugins:hibernate5:${gormVersion-'.RELEASE'}"
classpath 'net.saliman:gradle-cobertura-plugin:2.3.2'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3'
+ classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0"
}
}
-plugins {
- id 'com.jfrog.bintray' version '1.2'
-}
-
version '5.2.0'
group 'org.grails.plugins'
-apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.grails.grails-plugin'
apply plugin: 'org.grails.grails-plugin-publish'
apply plugin: 'cobertura'
apply plugin: 'com.github.kt3k.coveralls'
-
+apply plugin: 'com.jfrog.bintray'
ext {
gradleWrapperVersion = project.gradleWrapperVersion
@@ -39,8 +35,8 @@ ext {
hibernateVersion = project.hibernateVersion
}
-sourceCompatibility = 1.7
-targetCompatibility = 1.7
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
cobertura {
coverageExcludes = ['.*BootStrap.*', '.*test.*']
@@ -68,14 +64,6 @@ repositories {
maven { url 'https://repo.grails.org/grails/core' }
}
-
-dependencyManagement {
- imports {
- mavenBom "org.grails:grails-bom:$grailsVersion"
- }
- applyMavenExclusions false
-}
-
dependencies {
// Grails deps
compile 'org.springframework.boot:spring-boot-starter-logging'
@@ -86,15 +74,18 @@ dependencies {
compile 'org.grails:grails-dependencies'
compile 'org.grails:grails-web-boot'
console 'org.grails:grails-console'
+ compile 'com.google.code.gson:gson:2.8.2'
+
profile 'org.grails.profiles:web-plugin:3.1.0'
provided 'org.grails:grails-plugin-services'
provided 'org.grails:grails-plugin-domain-class'
testCompile 'org.grails:grails-plugin-testing'
+ testCompile 'org.grails:grails-gorm-testing-support'
testCompile 'org.grails.plugins:geb'
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1'
testRuntime 'net.sourceforge.htmlunit:htmlunit:2.18'
- provided 'org.postgresql:postgresql:9.4.1211.jre7'
+ provided 'org.postgresql:postgresql:42.2.2'
// plugins
provided 'org.grails.plugins:hibernate5'
diff --git a/gradle.properties b/gradle.properties
index fcc6229..4eec868 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-gradleWrapperVersion=3.1
-grailsVersion=3.2.2
-hibernateVersion=5.1.1.Final
-gormVersion=6.0.3
+gradleWrapperVersion=3.5
+grailsVersion=3.3.5
+hibernateVersion=5.2.16.Final
+gormVersion=6.1.9.RELEASE
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 416e1c2..4e6f425 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip
diff --git a/grails-app/conf/application.yml b/grails-app/conf/application.yml
index 0c11863..a57c2fe 100644
--- a/grails-app/conf/application.yml
+++ b/grails-app/conf/application.yml
@@ -22,7 +22,7 @@ dataSource:
username: postgres_extensions
password: postgres_extensions
url: jdbc:postgresql://localhost/pg_extensions_test
- dbCreate: create
+ dbCreate: create-drop
hibernate:
dialect: net.kaleidos.hibernate.PostgresqlExtensionsDialect
\ No newline at end of file
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgContainsCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgContainsCriteriaTestServiceIntegrationSpec.groovy
index 872eaf1..7dd8c6e 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgContainsCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgContainsCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.hibernate.HibernateException
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgEqualsCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgEqualsCriteriaTestServiceIntegrationSpec.groovy
index 9e8dc70..e479947 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgEqualsCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgEqualsCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.hibernate.HibernateException
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgILikeCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgILikeCriteriaTestServiceIntegrationSpec.groovy
index 408f706..bf99d12 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgILikeCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgILikeCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsContainedByCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsContainedByCriteriaTestServiceIntegrationSpec.groovy
index 356e81e..2d9d012 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsContainedByCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsContainedByCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.hibernate.HibernateException
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsEmptyCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsEmptyCriteriaTestServiceIntegrationSpec.groovy
index 56b7853..4b8515a 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsEmptyCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsEmptyCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsEmptyOrContainsCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsEmptyOrContainsCriteriaTestServiceIntegrationSpec.groovy
index e628aec..4fd86b2 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsEmptyOrContainsCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsEmptyOrContainsCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsNotEmptyCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsNotEmptyCriteriaTestServiceIntegrationSpec.groovy
index 40bd8dd..997d307 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsNotEmptyCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgIsNotEmptyCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgNotEqualsCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgNotEqualsCriteriaTestServiceIntegrationSpec.groovy
index d14830a..6be5186 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgNotEqualsCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgNotEqualsCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.hibernate.HibernateException
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgOverlapsCriteriaTestServiceIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgOverlapsCriteriaTestServiceIntegrationSpec.groovy
index 8befadd..97484b1 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PgOverlapsCriteriaTestServiceIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PgOverlapsCriteriaTestServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.hibernate.HibernateException
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/array/PostgresqlArraysDomainIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/array/PostgresqlArraysDomainIntegrationSpec.groovy
index e4eb959..10edaca 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/array/PostgresqlArraysDomainIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/array/PostgresqlArraysDomainIntegrationSpec.groovy
@@ -1,16 +1,10 @@
package net.kaleidos.hibernate.array
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
import spock.lang.Unroll
-import test.array.TestDouble
-import test.array.TestEnum
-import test.array.TestFloat
-import test.array.TestInteger
-import test.array.TestLong
-import test.array.TestString
-import test.array.TestUuid
+import test.array.*
@Integration
@Transactional
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreContainsIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreContainsIntegrationSpec.groovy
index 86bb72b..fdf3575 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreContainsIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreContainsIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.hstore
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreContainsKeyIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreContainsKeyIntegrationSpec.groovy
index 1a93603..5e36279 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreContainsKeyIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreContainsKeyIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.hstore
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreILikeValueFunctionIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreILikeValueFunctionIntegrationSpec.groovy
index fece897..eb452d7 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreILikeValueFunctionIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreILikeValueFunctionIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.hstore
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreIsContainedIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreIsContainedIntegrationSpec.groovy
index 7c5ce7e..994e2cb 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreIsContainedIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PgHstoreIsContainedIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.hstore
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PostgresqlHstoreMapDomainIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PostgresqlHstoreMapDomainIntegrationSpec.groovy
index f653f69..3ae7455 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PostgresqlHstoreMapDomainIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/hstore/PostgresqlHstoreMapDomainIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.hstore
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
import spock.lang.Unroll
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonEqualsIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonEqualsIntegrationSpec.groovy
index 07a4944..ae813ff 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonEqualsIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonEqualsIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.json
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonbContainsIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonbContainsIntegrationSpec.groovy
index ca58816..0b5c528 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonbContainsIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonbContainsIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.json
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonbIsContainedIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonbIsContainedIntegrationSpec.groovy
index b306090..bcb88d8 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonbIsContainedIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/json/PgJsonbIsContainedIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.json
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/json/PostgresqlJsonMapDomainIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/json/PostgresqlJsonMapDomainIntegrationSpec.groovy
index b09dc29..1f8b496 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/json/PostgresqlJsonMapDomainIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/json/PostgresqlJsonMapDomainIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.json
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
import spock.lang.Unroll
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/json/PostgresqlJsonbMapDomainIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/json/PostgresqlJsonbMapDomainIntegrationSpec.groovy
index 7fbf998..02e7cf6 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/json/PostgresqlJsonbMapDomainIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/json/PostgresqlJsonbMapDomainIntegrationSpec.groovy
@@ -1,6 +1,6 @@
package net.kaleidos.hibernate.json
-import grails.test.mixin.integration.Integration
+import grails.testing.mixin.integration.Integration
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
import spock.lang.Unroll
diff --git a/src/integration-test/groovy/net/kaleidos/hibernate/order/PgOrderIntegrationSpec.groovy b/src/integration-test/groovy/net/kaleidos/hibernate/order/PgOrderIntegrationSpec.groovy
index 8ac2019..5a53702 100644
--- a/src/integration-test/groovy/net/kaleidos/hibernate/order/PgOrderIntegrationSpec.groovy
+++ b/src/integration-test/groovy/net/kaleidos/hibernate/order/PgOrderIntegrationSpec.groovy
@@ -1,7 +1,7 @@
package net.kaleidos.hibernate.order
-import grails.test.mixin.integration.Integration
-import grails.transaction.Rollback
+import grails.gorm.transactions.Rollback
+import grails.testing.mixin.integration.Integration
import spock.lang.Specification
import test.json.TestMapJsonb
diff --git a/src/main/groovy/net/kaleidos/hibernate/usertype/ArrayType.java b/src/main/groovy/net/kaleidos/hibernate/usertype/ArrayType.java
index 0dad360..0142d95 100644
--- a/src/main/groovy/net/kaleidos/hibernate/usertype/ArrayType.java
+++ b/src/main/groovy/net/kaleidos/hibernate/usertype/ArrayType.java
@@ -2,21 +2,13 @@ package net.kaleidos.hibernate.usertype;
import net.kaleidos.hibernate.utils.PgArrayUtils;
import org.hibernate.HibernateException;
-import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.usertype.ParameterizedType;
import org.hibernate.usertype.UserType;
import java.io.Serializable;
-import java.sql.Array;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.UUID;
+import java.sql.*;
+import java.util.*;
public class ArrayType implements UserType, ParameterizedType {
public static final int INTEGER_ARRAY = 90001;
@@ -149,7 +141,7 @@ public class ArrayType implements UserType, ParameterizedType {
}
@Override
- public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
+ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
Object result = null;
Class typeArrayClass = java.lang.reflect.Array.newInstance(typeClass, 0).getClass();
Array sqlArray = rs.getArray(names[0]);
@@ -169,7 +161,7 @@ public class ArrayType implements UserType, ParameterizedType {
}
@Override
- public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException {
+ public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
if (value == null) {
st.setNull(index, Types.ARRAY);
return;
@@ -202,8 +194,9 @@ public class ArrayType implements UserType, ParameterizedType {
private void ensureBidiMapInitialized() throws HibernateException {
try {
- if (bidiMap == null)
+ if (bidiMap == null) {
bidiMap = new BidiEnumMap(typeClass);
+ }
} catch (Exception e) {
throw new HibernateException("Unable to create bidirectional enum map for " + typeClass, e);
}
diff --git a/src/main/groovy/net/kaleidos/hibernate/usertype/HstoreMapType.groovy b/src/main/groovy/net/kaleidos/hibernate/usertype/HstoreMapType.groovy
index 0ace5b5..e590786 100644
--- a/src/main/groovy/net/kaleidos/hibernate/usertype/HstoreMapType.groovy
+++ b/src/main/groovy/net/kaleidos/hibernate/usertype/HstoreMapType.groovy
@@ -2,7 +2,7 @@ package net.kaleidos.hibernate.usertype
import groovy.transform.CompileStatic
import org.hibernate.HibernateException
-import org.hibernate.engine.spi.SessionImplementor
+import org.hibernate.engine.spi.SharedSessionContractImplementor
import org.hibernate.usertype.UserType
import java.sql.PreparedStatement
@@ -38,14 +38,14 @@ class HstoreMapType implements UserType {
x ? x.hashCode() : 0
}
- Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
+ Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
String col = names[0]
String val = rs.getString(col)
return HstoreHelper.toMap(val)
}
- void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException {
+ void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
String s = HstoreHelper.toString(value as Map)
st.setObject(index, s, Types.OTHER)
}
diff --git a/src/main/groovy/net/kaleidos/hibernate/usertype/HstoreParser.java b/src/main/groovy/net/kaleidos/hibernate/usertype/HstoreParser.java
index 1eec4ce..12f5825 100644
--- a/src/main/groovy/net/kaleidos/hibernate/usertype/HstoreParser.java
+++ b/src/main/groovy/net/kaleidos/hibernate/usertype/HstoreParser.java
@@ -31,10 +31,10 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
this.length = rawValue == null ? 0 : rawValue.length();
}
- public Map<String,String> asMap() {
+ public Map<String, String> asMap() {
HashMap<String, String> r = new HashMap<String, String>();
try {
- for (final HStoreIterator iterator = new HStoreIterator(); iterator.hasNext();) {
+ for (final HStoreIterator iterator = new HStoreIterator(); iterator.hasNext(); ) {
final HStoreEntry entry = iterator.rawNext();
r.put(entry.key, entry.value);
}
@@ -44,7 +44,7 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
return r;
}
- private static class HStoreEntry implements Entry<String,String> {
+ private static class HStoreEntry implements Entry<String, String> {
private String key;
private String value;
@@ -75,7 +75,7 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
WaitingForKey, WaitingForEquals, WaitingForGreater, WaitingForValue, WaitingForComma
}
- private static final char[] QUOTE = {'"','\''};
+ private static final char[] QUOTE = {'"', '\''};
private static final char NO_QUOTE_CHAR = '\0';
private static final char EQUALS = '=';
private static final char GREATER = '>';
@@ -107,6 +107,7 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
return lastReturned;
}
+ @Override
public Entry<String, String> next() throws NoSuchElementException, IllegalStateException {
try {
return rawNext();
@@ -118,6 +119,7 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
/**
* Advance in parsing the rawValue string and assign the nextValue
* It creates a new nextElement or assigns null to it, if there are no more elements
+ *
* @throws HstoreParseException
*/
private void advance() throws HstoreParseException {
@@ -129,7 +131,9 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
final char ch = value.charAt(++position);
switch (state) {
case WaitingForKey:
- if (Character.isWhitespace(ch)) continue;
+ if (Character.isWhitespace(ch)) {
+ continue;
+ }
for (char q : QUOTE) {
if (ch == q) {
currentQuoteChar = q;
@@ -145,7 +149,9 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
state = ParseState.WaitingForEquals;
continue;
case WaitingForEquals:
- if (Character.isWhitespace(ch)) continue;
+ if (Character.isWhitespace(ch)) {
+ continue;
+ }
if (ch == EQUALS) {
state = ParseState.WaitingForGreater;
continue;
@@ -162,7 +168,9 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
throw new HstoreParseException("Expected '=>' key-value separator", position);
case WaitingForValue:
- if (Character.isWhitespace(ch)) continue;
+ if (Character.isWhitespace(ch)) {
+ continue;
+ }
for (char q : QUOTE) {
if (ch == q) {
currentQuoteChar = q;
@@ -181,7 +189,9 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
state = ParseState.WaitingForComma;
continue;
case WaitingForComma:
- if (Character.isWhitespace(ch)) continue;
+ if (Character.isWhitespace(ch)) {
+ continue;
+ }
if (ch == COMMA) {
// we are done
break loop;
@@ -254,7 +264,7 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
private String advanceWord(final char stopAtChar) throws HstoreParseException {
final int firstWordPosition = position;
- while(position < length) {
+ while (position < length) {
final char ch = value.charAt(position);
if (ch == currentQuoteChar) {
throw new HstoreParseException("Unexpected quote in word", position);
@@ -267,7 +277,7 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
// step back as we are already one char away
position--;
// substring is using quite a strange way of defining end position
- return value.substring(firstWordPosition, position + 1 );
+ return value.substring(firstWordPosition, position + 1);
}
@Override
@@ -276,6 +286,7 @@ public class HstoreParser extends PGobject implements Iterable<Map.Entry<String,
}
}
+ @Override
public Iterator<Entry<String, String>> iterator() {
try {
return new HStoreIterator();
diff --git a/src/main/groovy/net/kaleidos/hibernate/usertype/JsonMapType.groovy b/src/main/groovy/net/kaleidos/hibernate/usertype/JsonMapType.groovy
index 7073f60..9be558d 100644
--- a/src/main/groovy/net/kaleidos/hibernate/usertype/JsonMapType.groovy
+++ b/src/main/groovy/net/kaleidos/hibernate/usertype/JsonMapType.groovy
@@ -5,7 +5,7 @@ import com.google.gson.GsonBuilder
import groovy.transform.CompileStatic
import org.apache.commons.lang.ObjectUtils
import org.hibernate.HibernateException
-import org.hibernate.engine.spi.SessionImplementor
+import org.hibernate.engine.spi.SharedSessionContractImplementor
import org.hibernate.usertype.UserType
import org.postgresql.util.PGobject
@@ -44,7 +44,7 @@ class JsonMapType implements UserType {
}
@Override
- Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
+ Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
PGobject o = rs.getObject(names[0]) as PGobject
String jsonString = o?.value
@@ -52,7 +52,7 @@ class JsonMapType implements UserType {
}
@Override
- void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException {
+ void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
if (value == null) {
st.setNull(index, Types.OTHER)
} else {
@abcfy2 I think you can close this issue and wait for merge of this PR (which include your fixes also): https://github.com/kaleidos/grails-postgresql-extensions/pull/114
OK
Thanks to this extension. My question is that would you plan to add support hibernate 5.2 ?