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

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

commit 82b33ff73d2edd4e726e9b516bf551d9320b8377
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Wed May 28 22:08:36 2025 -0500

    Key sorting is fixed, but all sorted collection types must be SortedSet
---
 .../grails/orm/hibernate/cfg/GrailsDomainBinder.java    |  2 ++
 .../HibernateConnectionSourceSettings.groovy            | 17 +++++++++++++++++
 .../CompositeIdWithManyToOneAndSequenceSpec.groovy      |  2 +-
 .../grails/gorm/specs/HibernateGormDatastoreSpec.groovy |  2 +-
 .../CompositeIdWithDeepOneToManyMappingSpec.groovy      |  4 ++--
 .../GlobalConstraintWithCompositeIdSpec.groovy          |  2 +-
 .../HibernateConnectionSourceSettingsSpec.groovy        |  3 ++-
 7 files changed, 26 insertions(+), 6 deletions(-)

diff --git 
a/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
 
b/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
index 35c8823882..574ba1a070 100644
--- 
a/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
+++ 
b/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
@@ -907,6 +907,8 @@ public class GrailsDomainBinder implements 
MetadataContributor {
         // make nullable and non-updateable
         key.setNullable(true);
         key.setUpdateable(false);
+        //JPA now requires to check for sorting
+        key.setSorted(collection.isSorted());
         return key;
     }
 
diff --git 
a/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/connections/HibernateConnectionSourceSettings.groovy
 
b/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/connections/HibernateConnectionSourceSettings.groovy
index 975e2d5af8..5d329ffec4 100644
--- 
a/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/connections/HibernateConnectionSourceSettings.groovy
+++ 
b/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/connections/HibernateConnectionSourceSettings.groovy
@@ -180,6 +180,11 @@ class HibernateConnectionSourceSettings extends 
ConnectionSourceSettings {
          */
         String[] packagesToScan
 
+        /**
+         * JPA Settings
+         */
+        JpaSettings jpa = new JpaSettings()
+
         /**
          * Any additional properties that should be passed through as is.
          */
@@ -219,6 +224,7 @@ class HibernateConnectionSourceSettings extends 
ConnectionSourceSettings {
                 props.put("hibernate.config_class".toString(), 
configClass.name)
             }
             props.put('hibernate.use_query_cache', 
String.valueOf(cache.queries))
+            props.put('hibernate.jpa.compliance.cascade', 
String.valueOf(jpa.compliance.cascade))
 
             if (entity_dirtiness_strategy != null && !hibernateDirtyChecking) {
                 props.put('hibernate.entity_dirtiness_strategy', 
entity_dirtiness_strategy.name)
@@ -317,6 +323,17 @@ class HibernateConnectionSourceSettings extends 
ConnectionSourceSettings {
             boolean enabled = true
         }
 
+        @Builder(builderStrategy = SimpleStrategy, prefix = '')
+        @AutoClone
+        static class JpaSettings {
+            JpaComplianceSettings compliance = new JpaComplianceSettings();
+        }
+
+        @Builder(builderStrategy = SimpleStrategy, prefix = '')
+        static class JpaComplianceSettings {
+            boolean cascade = true
+        }
+
 
     }
 }
diff --git 
a/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/CompositeIdWithManyToOneAndSequenceSpec.groovy
 
b/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/CompositeIdWithManyToOneAndSequenceSpec.groovy
index f4bf371c91..bb39f16f53 100644
--- 
a/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/CompositeIdWithManyToOneAndSequenceSpec.groovy
+++ 
b/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/CompositeIdWithManyToOneAndSequenceSpec.groovy
@@ -57,7 +57,7 @@ class CompositeIdWithManyToOneAndSequenceSpec extends 
HibernateGormDatastoreSpec
 @Entity
 class Tooth {
     Integer id
-    TreeSet<ToothDisease> toothDisease = new TreeSet<>()
+    SortedSet<ToothDisease> toothDisease
     static mapping = {
         table name: 'AK_TOOTH'
         id generator: 'sequence', params: [sequence: 'SEQ_AK_TOOTH']
diff --git 
a/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/HibernateGormDatastoreSpec.groovy
 
b/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/HibernateGormDatastoreSpec.groovy
index 8a2d9e5434..a1abe33517 100644
--- 
a/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/HibernateGormDatastoreSpec.groovy
+++ 
b/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/HibernateGormDatastoreSpec.groovy
@@ -27,7 +27,7 @@ class HibernateGormDatastoreSpec extends 
GrailsDataTckSpec<GrailsDataHibernate6T
                 'hibernate.flush.mode'         : 'COMMIT',
                 'hibernate.cache.queries'      : 'true',
                 'hibernate.hbm2ddl.auto'       : 'create',
-                'hibernate.type.descriptor.sql': 'true'
+                'hibernate.jpa.compliance.cascade': 'true',
         ]
     }
 }
diff --git 
a/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/compositeid/CompositeIdWithDeepOneToManyMappingSpec.groovy
 
b/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/compositeid/CompositeIdWithDeepOneToManyMappingSpec.groovy
index d5e47aac0e..a62f6ea880 100644
--- 
a/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/compositeid/CompositeIdWithDeepOneToManyMappingSpec.groovy
+++ 
b/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/compositeid/CompositeIdWithDeepOneToManyMappingSpec.groovy
@@ -75,7 +75,7 @@ class Child implements Serializable, Comparable<Child> {
 @Entity
 class Parent implements Serializable, Comparable<Parent> {
     String name
-    TreeSet<Child> children
+    SortedSet<Child> children
 
     static belongsTo = [grandParent: GrandParent]
     static hasMany = [children: Child]
@@ -94,7 +94,7 @@ class Parent implements Serializable, Comparable<Parent> {
 class GrandParent implements Serializable {
     String name
     Integer luckyNumber
-    TreeSet<Parent> parents
+    SortedSet<Parent> parents
 
     static hasMany = [parents: Parent]
 
diff --git 
a/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/compositeid/GlobalConstraintWithCompositeIdSpec.groovy
 
b/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/compositeid/GlobalConstraintWithCompositeIdSpec.groovy
index fb82ce86ea..ab587368e7 100644
--- 
a/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/compositeid/GlobalConstraintWithCompositeIdSpec.groovy
+++ 
b/grails-data-hibernate6/core/src/test/groovy/grails/gorm/specs/compositeid/GlobalConstraintWithCompositeIdSpec.groovy
@@ -86,7 +86,7 @@ class ParentB implements Serializable {
 
     String code
     String desc
-    TreeSet<ChildB> children
+    SortedSet<ChildB> children
 
     static hasMany = [children: ChildB]
 
diff --git 
a/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/connections/HibernateConnectionSourceSettingsSpec.groovy
 
b/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/connections/HibernateConnectionSourceSettingsSpec.groovy
index b74ba7af41..9612944488 100644
--- 
a/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/connections/HibernateConnectionSourceSettingsSpec.groovy
+++ 
b/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/connections/HibernateConnectionSourceSettingsSpec.groovy
@@ -39,7 +39,7 @@ class HibernateConnectionSourceSettingsSpec extends 
Specification {
                 'hibernate.hbm2ddl.auto': 'create',
                 
'hibernate.cache':['region.factory_class':'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory'],
                 'hibernate.configLocations':'file:hibernate.cfg.xml',
-                'org.hibernate.foo':'bar'
+                'hibernate.jpa.compliance.cascade': 'true',
         ]
         HibernateConnectionSourceSettingsBuilder builder = new 
HibernateConnectionSourceSettingsBuilder(DatastoreUtils.createPropertyResolver(config))
         HibernateConnectionSourceSettings settings = builder.build()
@@ -60,6 +60,7 @@ class HibernateConnectionSourceSettingsSpec extends 
Specification {
         expectedHibernateProperties.put('hibernate.use_query_cache','true')
         expectedHibernateProperties.put("hibernate.connection.handling_mode", 
"DELAYED_ACQUISITION_AND_HOLD")
         
expectedHibernateProperties.put('hibernate.cache.region.factory_class','org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory')
+        expectedHibernateProperties.put('hibernate.jpa.compliance.cascade', 
'true')
         expectedHibernateProperties.put('org.hibernate.foo','bar')
 
         def expectedCombinedProperties = new Properties()

Reply via email to