You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by bo...@apache.org on 2026/06/23 21:06:42 UTC

(grails-core) branch 8.0.x-hibernate7 updated (b90629e477 -> 4ad6c766b6)

This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a change to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git


    from b90629e477 Fix H7 HibernateGrailsPlugin title and description — update Hibernate 5 to 7
     new b6607702bc Revert WhereQueryOldIssueVerificationSpec belongsTo change in H5
     new 3bf895dbc8 Remove stray blank line in SaveWithInvalidEntitySpec
     new 64ccc9ab02 Restore original license header in Hibernate5OptimisticLockingSpec
     new 4ad6c766b6 Revert CompositeIdWithManyToOneAndSequenceSpec to 8.0.x in H5

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../CompositeIdWithManyToOneAndSequenceSpec.groovy | 86 ++++++----------------
 .../tests/Hibernate5OptimisticLockingSpec.groovy   | 28 +++----
 .../WhereQueryOldIssueVerificationSpec.groovy      |  3 +-
 .../validation/SaveWithInvalidEntitySpec.groovy    |  1 -
 4 files changed, 39 insertions(+), 79 deletions(-)


(grails-core) 04/04: Revert CompositeIdWithManyToOneAndSequenceSpec to 8.0.x in H5

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 4ad6c766b64974097efca0422afbe63c630133d8
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Tue Jun 23 16:01:00 2026 -0500

    Revert CompositeIdWithManyToOneAndSequenceSpec to 8.0.x in H5
    
    The PR had inverted this spec's relationship from many-to-one to one-to-many
    and renamed the test, while the class kept its ...ManyToOne... name and the H7
    twin kept the original many-to-one form. That changed what the test covers and
    broke H5/H7 symmetry. Reverting restores the original many-to-one semantics and
    re-aligns H5 with its H7 twin (modulo the H5/H7 sequence-param difference).
    Verified: spec passes 1/1.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <no...@anthropic.com>
---
 .../CompositeIdWithManyToOneAndSequenceSpec.groovy | 86 ++++++----------------
 1 file changed, 24 insertions(+), 62 deletions(-)

diff --git a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/CompositeIdWithManyToOneAndSequenceSpec.groovy b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/CompositeIdWithManyToOneAndSequenceSpec.groovy
index 6a7bff10a0..7d7890fbbe 100644
--- a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/CompositeIdWithManyToOneAndSequenceSpec.groovy
+++ b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/CompositeIdWithManyToOneAndSequenceSpec.groovy
@@ -21,36 +21,32 @@ package grails.gorm.tests
 
 import grails.gorm.annotation.Entity
 import grails.gorm.transactions.Rollback
-
+import org.grails.orm.hibernate.HibernateDatastore
+import org.springframework.transaction.PlatformTransactionManager
+import spock.lang.AutoCleanup
 import spock.lang.Issue
+import spock.lang.Shared
+import spock.lang.Specification
 
 /**
  * Created by graemerocher on 26/01/2017.
  */
-class CompositeIdWithManyToOneAndSequenceSpec extends HibernateGormDatastoreSpec {
+class CompositeIdWithManyToOneAndSequenceSpec extends Specification {
 
-    def setupSpec() {
-        manager.registerDomainClasses(Tooth, ToothDisease)
-    }
+    @AutoCleanup @Shared HibernateDatastore datastore = new HibernateDatastore(Tooth, ToothDisease)
+    @Shared PlatformTransactionManager transactionManager = datastore.transactionManager
 
     @Rollback
     @Issue('https://github.com/apache/grails-data-mapping/issues/835')
-    void "Test composite id one to many and sequence"() {
-
-        when:"a one to many association is created"
-        def tooth = new Tooth()
-        def td = new ToothDisease(idColumn: 1, nrVersion: 1)
-        tooth.addToToothDiseases(td)
-        tooth.save(flush: true, failOnError: true)
+    void "Test composite id many to one and sequence"() {
 
-        and:"the session is cleared to ensure we are checking persisted state"
-        manager.session.clear()
+        when:"a many to one association is created"
+        ToothDisease td = new ToothDisease(nrVersion: 1).save()
+        new Tooth(toothDisease: td).save(flush:true)
 
-        then:"The object was saved and the association is correct"
+        then:"The object was saved"
         Tooth.count() == 1
-        ToothDisease.count() == 1
-        def reloadedTooth = Tooth.list().first()
-        reloadedTooth.toothDiseases.size() == 1
+        Tooth.list().first().toothDisease != null
     }
 
 }
@@ -59,59 +55,25 @@ class CompositeIdWithManyToOneAndSequenceSpec extends HibernateGormDatastoreSpec
 @Entity
 class Tooth {
     Integer id
-    SortedSet<ToothDisease> toothDiseases
-
-    static hasMany = [toothDiseases: ToothDisease]
-    static mappedBy = [toothDiseases: 'tooth']
-
+    ToothDisease toothDisease
     static mapping = {
         table name: 'AK_TOOTH'
-        id generator: 'native', params: [sequence_name: 'SEQ_AK_TOOTH']
+        id generator: 'sequence', params: [sequence: 'SEQ_AK_TOOTH']
+        toothDisease {
+            column name: 'FK_AK_TOOTH_ID'
+            column name: 'FK_AK_TOOTH_NR_VERSION'
+        }
     }
 }
 
 @Entity
-class ToothDisease implements Serializable, Comparable<ToothDisease> {
+class ToothDisease implements Serializable {
     Integer idColumn
     Integer nrVersion
-
-    static belongsTo = [tooth: Tooth]
-
     static mapping = {
         table name: 'AK_TOOTH_DISEASE'
-        idColumn column: 'ID', type: 'integer'
-        nrVersion column: 'NR_VERSION', type: 'integer'
+        idColumn column: 'ID', generator: 'sequence', params: [sequence: 'SEQ_AK_TOOTH_DISEASE']
+        nrVersion column: 'NR_VERSION'
         id composite: ['idColumn', 'nrVersion']
-        tooth column: 'tooth_id'
     }
-
-    @Override
-    int compareTo(ToothDisease other) {
-        def idCmp = this.idColumn <=> other.idColumn
-        if (idCmp != 0) {
-            return idCmp
-        }
-        return this.nrVersion <=> other.nrVersion
-    }
-
-    @Override
-    boolean equals(Object o) {
-        if (this.is(o)) return true
-        if (getClass() != o.getClass()) return false
-
-        ToothDisease that = (ToothDisease) o
-
-        if (idColumn != that.idColumn) return false
-        if (nrVersion != that.nrVersion) return false
-
-        return true
-    }
-
-    @Override
-    int hashCode() {
-        int result
-        result = idColumn.hashCode()
-        result = 31 * result + nrVersion.hashCode()
-        return result
-    }
-}
+}
\ No newline at end of file


(grails-core) 03/04: Restore original license header in Hibernate5OptimisticLockingSpec

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 64ccc9ab02463bffb766cef9f76a4a726c8bf0b7
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Tue Jun 23 15:47:52 2026 -0500

    Restore original license header in Hibernate5OptimisticLockingSpec
    
    The license header was unintentionally reformatted (two-space to one-space
    indentation). Restore the canonical Apache header to match 8.0.x; the test
    changes in this file are unaffected.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <no...@anthropic.com>
---
 .../tests/Hibernate5OptimisticLockingSpec.groovy   | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/Hibernate5OptimisticLockingSpec.groovy b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/Hibernate5OptimisticLockingSpec.groovy
index 78afce4dea..b33c04f92e 100644
--- a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/Hibernate5OptimisticLockingSpec.groovy
+++ b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/Hibernate5OptimisticLockingSpec.groovy
@@ -1,20 +1,20 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
  *
- *   https://www.apache.org/licenses/LICENSE-2.0
+ *    https://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
  */
 package grails.gorm.tests
 


(grails-core) 02/04: Remove stray blank line in SaveWithInvalidEntitySpec

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 3bf895dbc8657894d07850f712a5731b5bf9ac87
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Tue Jun 23 15:25:05 2026 -0500

    Remove stray blank line in SaveWithInvalidEntitySpec
    
    Drop the extra blank line between the package statement and imports - an
    unintentional formatting artifact. Restores the single-blank-line convention.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <no...@anthropic.com>
---
 .../groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy | 1 -
 1 file changed, 1 deletion(-)

diff --git a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy
index 6e8d99a659..9179e349c4 100644
--- a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy
+++ b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy
@@ -18,7 +18,6 @@
  */
 package grails.gorm.tests.validation
 
-
 import grails.gorm.annotation.Entity
 import grails.gorm.transactions.Rollback
 import org.grails.orm.hibernate.HibernateDatastore


(grails-core) 01/04: Revert WhereQueryOldIssueVerificationSpec belongsTo change in H5

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit b6607702bc8ef7c8a04551dd5e871ba21642e46f
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Tue Jun 23 15:23:44 2026 -0500

    Revert WhereQueryOldIssueVerificationSpec belongsTo change in H5
    
    The belongsTo = [WqBiAuthor] edit was unnecessary scope-bleed in an H5
    test file. Reverting to the original bare-class form belongsTo = WqBiAuthor
    restores the file to match 8.0.x and makes the H5 and H7 copies of the spec
    byte-for-byte identical again. Verified: spec passes 9/9.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <no...@anthropic.com>
---
 .../groovy/grails/gorm/tests/WhereQueryOldIssueVerificationSpec.groovy | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/WhereQueryOldIssueVerificationSpec.groovy b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/WhereQueryOldIssueVerificationSpec.groovy
index b53b4b9286..a53128760d 100644
--- a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/WhereQueryOldIssueVerificationSpec.groovy
+++ b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/WhereQueryOldIssueVerificationSpec.groovy
@@ -18,7 +18,6 @@
  */
 package grails.gorm.tests
 
-
 import grails.gorm.annotation.Entity
 import grails.gorm.hibernate.HibernateEntity
 import grails.gorm.transactions.Rollback
@@ -361,7 +360,7 @@ class WqBiBook implements HibernateEntity<WqBiBook> {
     String title
 
     static hasMany = [authors: WqBiAuthor]
-    static belongsTo = [WqBiAuthor]
+    static belongsTo = WqBiAuthor
 }
 
 @Entity