From 7da52050eb3ae3ba8d09e4fc564c8a4283b97996 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Fri, 25 Oct 2024 15:28:21 -0400 Subject: [PATCH 1/6] add grails-bom to resolve dependency versions --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 5fdd16892..406308f85 100644 --- a/build.gradle +++ b/build.gradle @@ -221,6 +221,8 @@ subprojects { Project subproject -> } dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") + documentation "org.fusesource.jansi:jansi:$jansiVersion" documentation "org.apache.groovy:groovy-dateutil:$groovyVersion" documentation "info.picocli:picocli:$picocliVersion" From d17da9717d492666107e562bcd3770ccad25b17a Mon Sep 17 00:00:00 2001 From: James Fredley Date: Fri, 25 Oct 2024 15:28:37 -0400 Subject: [PATCH 2/6] use Groovy 4.0.24-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4664af807..3b6b86c89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ grailsShellVersion=7.0.0-SNAPSHOT grailsSpringSecurityRestVersion=6.0.0-SNAPSHOT grailsVersion=7.0.0-SNAPSHOT groovydocGradlePluginVersion=1.0.1 -groovyVersion=4.0.23 +groovyVersion=4.0.24-SNAPSHOT # Tests are built for 1.4.200, so stick with older version h2Version=1.4.200 hibernate5Version=5.6.15.Final From 6c567f638a63b436e927b93a393722213560645d Mon Sep 17 00:00:00 2001 From: James Fredley Date: Fri, 25 Oct 2024 16:30:01 -0400 Subject: [PATCH 3/6] move grails-bom to resolve dependency versions for all subprojects --- build.gradle | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 406308f85..c2c01fbb4 100644 --- a/build.gradle +++ b/build.gradle @@ -117,9 +117,8 @@ subprojects { Project subproject -> } } - - dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") testImplementation "jakarta.annotation:jakarta.annotation-api:$jakartaAnnotationApiVersion" testImplementation "io.micrometer:micrometer-core:latest.integration" testImplementation "io.projectreactor:reactor-test:$projectReactorVersion" @@ -184,6 +183,10 @@ subprojects { Project subproject -> apply plugin: 'groovy' + dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") + } + configurations { documentation.extendsFrom(compileClasspath) } @@ -221,8 +224,6 @@ subprojects { Project subproject -> } dependencies { - implementation platform("org.grails:grails-bom:$grailsVersion") - documentation "org.fusesource.jansi:jansi:$jansiVersion" documentation "org.apache.groovy:groovy-dateutil:$groovyVersion" documentation "info.picocli:picocli:$picocliVersion" From 6c6688fd264fa300931a63e7c3eae4ca2fd87243 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Fri, 25 Oct 2024 16:31:22 -0400 Subject: [PATCH 4/6] use h2 version from grails-bom --- boot-plugin/build.gradle | 2 +- build.gradle | 1 - examples/spring-boot-hibernate5/build.gradle | 2 +- examples/standalone-hibernate5/build.gradle | 2 +- gradle.properties | 2 -- grails-datastore-gorm-hibernate5/build.gradle | 2 +- grails-plugin/build.gradle | 2 +- 7 files changed, 5 insertions(+), 8 deletions(-) diff --git a/boot-plugin/build.gradle b/boot-plugin/build.gradle index 69bf084fd..400c931d9 100644 --- a/boot-plugin/build.gradle +++ b/boot-plugin/build.gradle @@ -13,5 +13,5 @@ dependencies { testRuntimeOnly "org.apache.tomcat:tomcat-jdbc:$tomcatVersion" testRuntimeOnly "org.apache.tomcat.embed:tomcat-embed-logging-log4j:$tomcatLog4jVersion" - testRuntimeOnly "com.h2database:h2:$h2Version" + testRuntimeOnly "com.h2database:h2" } diff --git a/build.gradle b/build.gradle index c2c01fbb4..e424cde06 100644 --- a/build.gradle +++ b/build.gradle @@ -83,7 +83,6 @@ subprojects { Project subproject -> if(isExample) { apply plugin: "groovy" - ext['h2.version'] = h2Version ext['gorm.version'] = gormVersion if(subproject.name.startsWith("examples-grails")) { diff --git a/examples/spring-boot-hibernate5/build.gradle b/examples/spring-boot-hibernate5/build.gradle index 1f5dd6a97..22de4c9cf 100644 --- a/examples/spring-boot-hibernate5/build.gradle +++ b/examples/spring-boot-hibernate5/build.gradle @@ -30,7 +30,7 @@ dependencies { implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version" implementation "org.hibernate:hibernate-ehcache:$hibernate5Version" - runtimeOnly "com.h2database:h2:$h2Version" + runtimeOnly "com.h2database:h2" runtimeOnly "org.apache.tomcat:tomcat-jdbc:$tomcatVersion" runtimeOnly "org.apache.tomcat.embed:tomcat-embed-logging-log4j:$tomcatLog4jVersion" runtimeOnly "org.slf4j:slf4j-api:$slf4jVersion" diff --git a/examples/standalone-hibernate5/build.gradle b/examples/standalone-hibernate5/build.gradle index 52ae97ae7..5031995b4 100644 --- a/examples/standalone-hibernate5/build.gradle +++ b/examples/standalone-hibernate5/build.gradle @@ -4,7 +4,7 @@ apply plugin:"groovy" dependencies { implementation project(":grails-datastore-gorm-hibernate5") - runtimeOnly "com.h2database:h2:$h2Version" + runtimeOnly "com.h2database:h2" runtimeOnly "org.apache.tomcat:tomcat-jdbc:$tomcatVersion" runtimeOnly "org.apache.tomcat.embed:tomcat-embed-logging-log4j:$tomcatLog4jVersion" runtimeOnly "org.slf4j:slf4j-api:$slf4jVersion" diff --git a/gradle.properties b/gradle.properties index 3b6b86c89..982de0b41 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,8 +14,6 @@ grailsSpringSecurityRestVersion=6.0.0-SNAPSHOT grailsVersion=7.0.0-SNAPSHOT groovydocGradlePluginVersion=1.0.1 groovyVersion=4.0.24-SNAPSHOT -# Tests are built for 1.4.200, so stick with older version -h2Version=1.4.200 hibernate5Version=5.6.15.Final hibernateValidatorVersion=8.0.1.Final hibernateGroovyProxy=1.1 diff --git a/grails-datastore-gorm-hibernate5/build.gradle b/grails-datastore-gorm-hibernate5/build.gradle index 7524c464f..a36a29c66 100644 --- a/grails-datastore-gorm-hibernate5/build.gradle +++ b/grails-datastore-gorm-hibernate5/build.gradle @@ -38,7 +38,7 @@ dependencies { testImplementation "org.grails:grails-datastore-gorm-tck:$gormVersion", { exclude group: "org.spockframework" } - testImplementation "com.h2database:h2:$h2Version" + testImplementation "com.h2database:h2" testImplementation "org.hibernate:hibernate-ehcache:$hibernate5Version" diff --git a/grails-plugin/build.gradle b/grails-plugin/build.gradle index 2f3c5e4d2..8aa378cac 100644 --- a/grails-plugin/build.gradle +++ b/grails-plugin/build.gradle @@ -43,7 +43,7 @@ dependencies { } testRuntimeOnly "org.yaml:snakeyaml:$snakeYamlVersion" testImplementation "org.grails:grails-gorm-testing-support:$testingSupportVersion" - testRuntimeOnly "com.h2database:h2:$h2Version" + testRuntimeOnly "com.h2database:h2" testRuntimeOnly "org.apache.tomcat:tomcat-jdbc:$tomcatVersion" testRuntimeOnly "org.apache.tomcat.embed:tomcat-embed-logging-log4j:$tomcatLog4jVersion" testRuntimeOnly "org.springframework:spring-aop:$springVersion" From a9fa7462f985a5e04546c0c55b09a0065766f698 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Fri, 25 Oct 2024 17:17:56 -0400 Subject: [PATCH 5/6] restore domain inheritance tests --- .../grails-app/domain/functional/tests/Employee.groovy | 3 +-- .../gorm/tests/SubclassMultipleListCollectionSpec.groovy | 3 +-- .../grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy | 3 +-- .../gorm/tests/inheritance/SubclassToOneProxySpec.groovy | 3 +-- .../inheritance/TablePerConcreteClassAndDateCreatedSpec.groovy | 3 +-- .../grails/gorm/tests/validation/CascadeValidationSpec.groovy | 3 +-- .../grails/gorm/tests/validation/UniqueInheritanceSpec.groovy | 3 +-- .../grails/test/mixin/hibernate/HibernateSpecSpec.groovy | 3 +-- 8 files changed, 8 insertions(+), 16 deletions(-) diff --git a/examples/grails3-hibernate5/grails-app/domain/functional/tests/Employee.groovy b/examples/grails3-hibernate5/grails-app/domain/functional/tests/Employee.groovy index d36d967dc..d47b40f7a 100644 --- a/examples/grails3-hibernate5/grails-app/domain/functional/tests/Employee.groovy +++ b/examples/grails3-hibernate5/grails-app/domain/functional/tests/Employee.groovy @@ -1,7 +1,6 @@ package functional.tests -// TODO domain inheritance -class Employee /*extends Person*/ { +class Employee extends Person { static belongsTo = [ business: Business diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy index a83c6f4ba..fa4d78e34 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy @@ -47,8 +47,7 @@ class Iteration { // static mappedBy = [products: 'iteration', otherProducts: 'none'] } -// @Entity -// https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity and org.grails.datastore.gorm.GormEntity +@Entity class Product extends SuperProduct { static belongsTo = [iteration: Iteration] diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy index 07f9d34fe..edabeff49 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy @@ -73,8 +73,7 @@ class Company { tablePerSubclass true } } -// @Entity -// https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity and org.grails.datastore.gorm.GormEntity +@Entity class Vendor extends Company { static constraints = { diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/inheritance/SubclassToOneProxySpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/inheritance/SubclassToOneProxySpec.groovy index a80cea860..551a04ff1 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/inheritance/SubclassToOneProxySpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/inheritance/SubclassToOneProxySpec.groovy @@ -27,8 +27,7 @@ class SubclassToOneProxySpec extends GormDatastoreSpec { class SuperclassProxy { } -// @Entity -// https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity and org.grails.datastore.gorm.GormEntity +@Entity class SubclassProxy extends SuperclassProxy { } diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/inheritance/TablePerConcreteClassAndDateCreatedSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/inheritance/TablePerConcreteClassAndDateCreatedSpec.groovy index 4e24b7002..7309c0799 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/inheritance/TablePerConcreteClassAndDateCreatedSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/inheritance/TablePerConcreteClassAndDateCreatedSpec.groovy @@ -51,8 +51,7 @@ abstract class Vehicle { } } -// @Entity -// https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity and org.grails.datastore.gorm.GormEntity +@Entity class Spaceship extends Vehicle { static mapping = { dynamicUpdate true diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/CascadeValidationSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/CascadeValidationSpec.groovy index 903aa0cb2..640b2bc92 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/CascadeValidationSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/CascadeValidationSpec.groovy @@ -50,8 +50,7 @@ abstract class Person { } -// @Entity -// https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity and org.grails.datastore.gorm.GormEntity +@Entity class Employee extends Person { static belongsTo = [ diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueInheritanceSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueInheritanceSpec.groovy index 3203fbd00..c744cb093 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueInheritanceSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueInheritanceSpec.groovy @@ -70,8 +70,7 @@ class Item { Product product } -// @Entity -// https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity and org.grails.datastore.gorm.GormEntity +@Entity class ConcreteProduct extends Product { } diff --git a/grails-plugin/src/test/groovy/grails/test/mixin/hibernate/HibernateSpecSpec.groovy b/grails-plugin/src/test/groovy/grails/test/mixin/hibernate/HibernateSpecSpec.groovy index 22aa4d4f6..e5337e856 100644 --- a/grails-plugin/src/test/groovy/grails/test/mixin/hibernate/HibernateSpecSpec.groovy +++ b/grails-plugin/src/test/groovy/grails/test/mixin/hibernate/HibernateSpecSpec.groovy @@ -60,8 +60,7 @@ class Person { phone nullable: true } } -// @Entity -// https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity and org.grails.datastore.gorm.GormEntity +@Entity class Player extends Person { String sport String height From c8de45df204966ccc228b46b94beeb2142ae0f59 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Fri, 25 Oct 2024 17:18:39 -0400 Subject: [PATCH 6/6] fix failing tests by addressing h2 reserved words --- .../tests/events/UpdatePropertyInEventListenerSpec.groovy | 5 +++++ .../gorm/tests/validation/UniqueFalseConstraintSpec.groovy | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/events/UpdatePropertyInEventListenerSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/events/UpdatePropertyInEventListenerSpec.groovy index 5d562e43b..5533f18e5 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/events/UpdatePropertyInEventListenerSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/events/UpdatePropertyInEventListenerSpec.groovy @@ -69,6 +69,11 @@ class UpdatePropertyInEventListenerSpec extends Specification { class User { String username String password + + static mapping = { + table '`user`' + password column: '`password`' + } } class PasswordEncodingListener extends AbstractPersistenceEventListener { diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueFalseConstraintSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueFalseConstraintSpec.groovy index a566968b6..cb95154f5 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueFalseConstraintSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueFalseConstraintSpec.groovy @@ -37,4 +37,8 @@ class User { static constraints = { name unique: false } + + static mapping = { + table '`user`' + } }