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

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

commit 6e6a79c1848ed909e459d9be76c345aea351e063
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Wed Mar 4 20:25:36 2026 -0600

    cleanup(hibernate7):  Make sure updateable is not used internally.
---
 .../grails/orm/hibernate/cfg/PropertyConfig.groovy | 13 ++++---
 .../hibernate/HibernateMappingBuilder.groovy       |  7 +++-
 .../secondpass/CollectionKeyColumnUpdater.java     |  2 +-
 .../mapping/HibernateMappingBuilderSpec.groovy     |  4 +-
 .../mapping/HibernateMappingBuilderTests.groovy    |  8 ++--
 .../orm/hibernate/cfg/PropertyConfigSpec.groovy    | 14 ++++++-
 grails-doc/src/en/guide/index.adoc                 |  5 +++
 grails-doc/src/en/guide/reference.adoc             |  5 +++
 .../src/en/ref/Database Mapping/insertable.adoc    |  4 +-
 .../{updateable.adoc => updatable.adoc}            | 12 +++---
 .../src/en/ref/Database Mapping/updateable.adoc    | 43 +---------------------
 11 files changed, 52 insertions(+), 65 deletions(-)

diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/PropertyConfig.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/PropertyConfig.groovy
index 52e3d3dc92..fcd5adc14e 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/PropertyConfig.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/PropertyConfig.groovy
@@ -94,19 +94,20 @@ class PropertyConfig extends Property {
     /**
      * Whether or not this column is updatable by hibernate
      *
-     * @deprecated Use updatable instead
+     * @deprecated Use {@link #getUpdatable()} instead
      */
-    @Deprecated
+    @Deprecated(since = "7.0", forRemoval = true)
     boolean getUpdateable() {
         return updatable
     }
 
     /**
      * Whether or not this column is updatable by hibernate
-     * @deprecated Use updatable instead
+     *
+     * @deprecated Use {@code updatable} instead
      */
-    @Deprecated
-    void setUpdatable(boolean updateable) {
+    @Deprecated(since = "7.0", forRemoval = true)
+    void setUpdateable(boolean updateable) {
         this.updatable = updateable
     }
 
@@ -453,7 +454,7 @@ class PropertyConfig extends Property {
     }
 
     String toString() {
-        "property[type:$type, lazy:$lazy, columns:$columns, 
insertable:${insertable}, updateable:${updatable}]"
+        "property[type:$type, lazy:$lazy, columns:$columns, 
insertable:${insertable}, updatable:${updatable}]"
     }
 
     protected void checkHasSingleColumn() {
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateMappingBuilder.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateMappingBuilder.groovy
index f037f480a8..f97273b707 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateMappingBuilder.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateMappingBuilder.groovy
@@ -309,8 +309,11 @@ class HibernateMappingBuilder implements 
MappingConfigurationBuilder<Mapping, Pr
         if (typeVal != null) property.type = typeVal
         if (namedArgs.lazy instanceof Boolean) property.setLazy((Boolean) 
namedArgs.lazy)
         if (namedArgs.insertable instanceof Boolean) property.insertable = 
(Boolean) namedArgs.insertable
-        Object updateableVal = namedArgs.updateable != null ? 
namedArgs.updateable : namedArgs.updatable
-        if (updateableVal instanceof Boolean) property.updatable = (Boolean) 
updateableVal
+        if (namedArgs.updatable instanceof Boolean) property.updatable = 
(Boolean) namedArgs.updatable
+        if (namedArgs.updateable instanceof Boolean) {
+            LOG.warn("'updateable' is deprecated in domain class mapping; use 
'updatable' instead")
+            property.updatable = (Boolean) namedArgs.updateable
+        }
         Object cascadeVal = namedArgs.cascade
         if (cascadeVal != null) property.cascade = cascadeVal.toString()
         if (namedArgs.cascadeValidate instanceof Boolean) 
property.cascadeValidate = (Boolean) namedArgs.cascadeValidate
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionKeyColumnUpdater.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionKeyColumnUpdater.java
index 64fe89ac08..48a1fdd5cb 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionKeyColumnUpdater.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionKeyColumnUpdater.java
@@ -25,7 +25,7 @@ import org.hibernate.mapping.Collection;
 import org.hibernate.mapping.DependantValue;
 import org.hibernate.mapping.PersistentClass;
 
-/** Forces columns to be nullable and checks if the key is updateable. */
+/** Forces columns to be nullable and checks if the key is updatable. */
 public class CollectionKeyColumnUpdater {
 
   private final CollectionKeyBinder collectionKeyBinder;
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/hibernate/mapping/HibernateMappingBuilderSpec.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/hibernate/mapping/HibernateMappingBuilderSpec.groovy
index e72f31557a..ffded24547 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/hibernate/mapping/HibernateMappingBuilderSpec.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/hibernate/mapping/HibernateMappingBuilderSpec.groovy
@@ -197,9 +197,9 @@ class HibernateMappingBuilderSpec extends Specification {
         m.getPropertyConfig('myProp').accessType == AccessType.FIELD
     }
 
-    def "property updateable alias is honoured"() {
+    def "property updatable is honoured"() {
         when:
-        Mapping m = evaluate { myProp updateable: false }
+        Mapping m = evaluate { myProp updatable: false }
 
         then:
         !m.getPropertyConfig('myProp').updatable
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/hibernate/mapping/HibernateMappingBuilderTests.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/hibernate/mapping/HibernateMappingBuilderTests.groovy
index 7ecb0209af..3e6b9129d9 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/hibernate/mapping/HibernateMappingBuilderTests.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/hibernate/mapping/HibernateMappingBuilderTests.groovy
@@ -841,11 +841,11 @@ class HibernateMappingBuilderTests {
     void testUpdatablePropertyConfig() {
         def builder = new HibernateMappingBuilder("Foo")
         def mapping = builder.evaluate {
-            firstName updateable:true
-            lastName updateable:false
+            firstName updatable:true
+            lastName updatable:false
         }
-        assertTrue mapping.getPropertyConfig('firstName').updateable
-        assertFalse mapping.getPropertyConfig('lastName').updateable
+        assertTrue mapping.getPropertyConfig('firstName').updatable
+        assertFalse mapping.getPropertyConfig('lastName').updatable
     }
 
     @Test
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/PropertyConfigSpec.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/PropertyConfigSpec.groovy
index 38687e271f..ea61d362fa 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/PropertyConfigSpec.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/PropertyConfigSpec.groovy
@@ -444,7 +444,7 @@ class PropertyConfigSpec extends Specification {
 
     // ─── deprecated updateable 
───────────────────────────────────────────────
 
-    void "setUpdatable and getUpdateable are symmetric"() {
+    void "getUpdateable delegates to updatable"() {
         given:
         PropertyConfig pc = new PropertyConfig()
 
@@ -454,4 +454,16 @@ class PropertyConfigSpec extends Specification {
         then:
         !pc.updateable
     }
+
+    void "setUpdateable delegates to updatable"() {
+        given:
+        PropertyConfig pc = new PropertyConfig()
+
+        when:
+        pc.updateable = false
+
+        then:
+        !pc.updatable
+    }
+
 }
diff --git a/grails-doc/src/en/guide/index.adoc 
b/grails-doc/src/en/guide/index.adoc
index 0f32264d6b..83e1c00c24 100644
--- a/grails-doc/src/en/guide/index.adoc
+++ b/grails-doc/src/en/guide/index.adoc
@@ -1765,6 +1765,11 @@ include::ref/Database Mapping/type.adoc[]
 
 include::ref/Database Mapping/updateable.adoc[]
 
+[[ref-database-mapping-updatable]]
+==== updatable
+
+include::ref/Database Mapping/updatable.adoc[]
+
 [[ref-database-mapping-version]]
 ==== version
 
diff --git a/grails-doc/src/en/guide/reference.adoc 
b/grails-doc/src/en/guide/reference.adoc
index 21bf0e1617..42254fc5fa 100644
--- a/grails-doc/src/en/guide/reference.adoc
+++ b/grails-doc/src/en/guide/reference.adoc
@@ -570,6 +570,11 @@ include::ref/Database Mapping/type.adoc[]
 
 include::ref/Database Mapping/updateable.adoc[]
 
+[[ref-database-mapping-updatable]]
+==== updatable
+
+include::ref/Database Mapping/updatable.adoc[]
+
 [[ref-database-mapping-version]]
 ==== version
 
diff --git a/grails-doc/src/en/ref/Database Mapping/insertable.adoc 
b/grails-doc/src/en/ref/Database Mapping/insertable.adoc
index e06831eb54..d4029d43d2 100644
--- a/grails-doc/src/en/ref/Database Mapping/insertable.adoc    
+++ b/grails-doc/src/en/ref/Database Mapping/insertable.adoc    
@@ -41,7 +41,7 @@ class Book {
 
     static mapping = {
         author insertable: false
-        author updateable: false
+        author updatable: false
     }
 }
 ----
@@ -54,7 +54,7 @@ Usage: `association_name(insertable: boolean)`
 
 Useful in general where you don't want to set an initial value (or include the 
column in the generated SQL) during an initial `save()`.
 
-In particular this is useful for one-to-many relationships. For example when 
you store the foreign key in the 'child' table, it's often efficient to save 
the child using only the foreign key of the parent. You do this by setting the 
parent object (and the parent foreign key) in the 'child' entity. Setting the 
attributes insertable:false and updateable:false for the 'belongsTo' parent 
object lets you insert and update using only the foreign key.
+In particular this is useful for one-to-many relationships. For example when 
you store the foreign key in the 'child' table, it's often efficient to save 
the child using only the foreign key of the parent. You do this by setting the 
parent object (and the parent foreign key) in the 'child' entity. Setting the 
attributes `insertable: false` and `updatable: false` for the `belongsTo` 
parent object lets you insert and update using only the foreign key.
 
 [source,groovy]
 ----
diff --git a/grails-doc/src/en/ref/Database Mapping/updateable.adoc 
b/grails-doc/src/en/ref/Database Mapping/updatable.adoc
similarity index 77%
copy from grails-doc/src/en/ref/Database Mapping/updateable.adoc
copy to grails-doc/src/en/ref/Database Mapping/updatable.adoc
index 5e2a8aefed..e50ad9d731 100644
--- a/grails-doc/src/en/ref/Database Mapping/updateable.adoc    
+++ b/grails-doc/src/en/ref/Database Mapping/updatable.adoc     
@@ -18,7 +18,7 @@ under the License.
 ////
 
 
-== updateable
+== updatable
 
 
 
@@ -41,7 +41,7 @@ class Book {
 
     static mapping = {
         author insertable: false
-        author updateable: false
+        author updatable: false
     }
 }
 ----
@@ -50,15 +50,17 @@ class Book {
 === Description
 
 
-Usage: `association_name(updateable: boolean)`
+Usage: `association_name(updatable: boolean)`
 
 Useful in general where you don't want to update a value (or include the 
column in the generated SQL) during a `save()`.
 
-In particular this is useful for one-to-many relationships. For example when 
you store the foreign key in the 'child' table, it's often efficient to save 
the child using only the foreign key of the parent. You do this by setting the 
parent object (and the parent foreign key) in the 'child' entity. Setting the 
attributes insertable:false and updateable:false for the 'belongsTo' parent 
object lets you insert and update using only the foreign key.
+In particular this is useful for one-to-many relationships. For example when 
you store the foreign key in the 'child' table, it's often efficient to save 
the child using only the foreign key of the parent. You do this by setting the 
parent object (and the parent foreign key) in the 'child' entity. Setting the 
attributes `insertable: false` and `updatable: false` for the `belongsTo` 
parent object lets you insert and update using only the foreign key.
 
 [source,groovy]
 ----
 static mapping = {
-    author updateable: false
+    author updatable: false
 }
 ----
+
+NOTE: The key `updateable` (with an extra 'e') is a deprecated alias for 
`updatable` and will be removed in a future release. A deprecation warning is 
logged at startup when the old key is used.
diff --git a/grails-doc/src/en/ref/Database Mapping/updateable.adoc 
b/grails-doc/src/en/ref/Database Mapping/updateable.adoc
index 5e2a8aefed..1764a66ebd 100644
--- a/grails-doc/src/en/ref/Database Mapping/updateable.adoc    
+++ b/grails-doc/src/en/ref/Database Mapping/updateable.adoc    
@@ -20,45 +20,4 @@ under the License.
 
 == updateable
 
-
-
-=== Purpose
-
-
-Determines whether a property's database column is updated when persistent 
instances are updated.
-
-
-=== Examples
-
-
-[source,groovy]
-----
-class Book {
-
-    String title
-
-    static belongsTo = [author: Author]
-
-    static mapping = {
-        author insertable: false
-        author updateable: false
-    }
-}
-----
-
-
-=== Description
-
-
-Usage: `association_name(updateable: boolean)`
-
-Useful in general where you don't want to update a value (or include the 
column in the generated SQL) during a `save()`.
-
-In particular this is useful for one-to-many relationships. For example when 
you store the foreign key in the 'child' table, it's often efficient to save 
the child using only the foreign key of the parent. You do this by setting the 
parent object (and the parent foreign key) in the 'child' entity. Setting the 
attributes insertable:false and updateable:false for the 'belongsTo' parent 
object lets you insert and update using only the foreign key.
-
-[source,groovy]
-----
-static mapping = {
-    author updateable: false
-}
-----
+DEPRECATED: Use <<ref-database-mapping-updatable,updatable>> instead. The 
`updateable:` mapping key is a deprecated alias for `updatable:` and will be 
removed in a future release.

Reply via email to