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

borinquenkid pushed a commit to branch 9.0.x-h7-improvement-phase3
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 879798526ec52e7ea973e765e9f3599635e1a363
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Thu Oct 8 14:34:02 2026 -0500

    feat: accept insertable and updatable false on properties with no column in 
native domain binding
    
    The generated mode refused insertable: false and updatable: false on a 
collection, an embedded object and the inverse side of a one-to-one, on the 
belief that the domain binder ignores the flags there. Probed with both modes: 
the binder writes a collection and the inverse side of a one-to-one whatever 
the flags say (their rows live in their own table or on the other side), and 
applies the flags to an embedded object (the columns of the object are kept out 
of the insert or the update). [...]
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
 .../domainbinding/jpa/GrailsDomainGenerator.groovy |  39 +--
 .../GeneratedDomainClassesWriteFlagsSpec.groovy    | 269 +++++++++++++++++++++
 .../GrailsDomainGeneratorOptionCoverageSpec.groovy |  47 +++-
 .../advancedGORMFeatures/nativeDomainBinding.adoc  |   5 +-
 4 files changed, 314 insertions(+), 46 deletions(-)

diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/jpa/GrailsDomainGenerator.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/jpa/GrailsDomainGenerator.groovy
index c038eb92e9..3a5fda574d 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/jpa/GrailsDomainGenerator.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/jpa/GrailsDomainGenerator.groovy
@@ -1279,10 +1279,6 @@ class GrailsDomainGenerator {
         if (boundAsColumn(property)) {
             return columnCollectionProblem(property)
         }
-        String writeProblem = writeRestrictionProblem(mapped)
-        if (writeProblem != null) {
-            return writeProblem
-        }
         CollectionKind kind = CollectionKind.of(property.type)
         if (property.type == SortedSet) {
             return 'a SortedSet: the binder names java.util.SortedSet as the 
collection\'s custom type, which Hibernate rejects when it boots'
@@ -1331,21 +1327,6 @@ class GrailsDomainGenerator {
         return null
     }
 
-    /**
-     * {@code PropertyBinder} overwrites the insertable and updatable flags of 
every property with the ones of its columns, which
-     * are always set, so the binder ignores {@code insertable: false} and 
{@code updatable: false} (pinned in
-     * {@code GrailsDomainBinderOptionDefectSpec}). The generator states them 
where there is a column to state them on (a simple
-     * property, an enum, a foreign key). A property with no column of its 
own, an embedded object, a collection or the inverse
-     * side of a one-to-one, has nothing to state them on, so the generator 
rejects it rather than drop the option.
-     */
-    private static String writeRestrictionProblem(PropertyConfig mapped) {
-        if (mapped != null && (!mapped.insertable || !mapped.updatable)) {
-            return 'insertable: false or updatable: false is mapped on a 
property that has no column of its own (the binder ignores ' +
-                    'both for every property), and annotations cannot state 
them on it'
-        }
-        return null
-    }
-
     /**
      * @return why the generator cannot describe the collection whose owner or 
associated entity has a composite identifier, or
      *     {@code null} when it can: the key columns of a collection of the 
owner are one for each identifier property
@@ -1714,10 +1695,6 @@ class GrailsDomainGenerator {
      */
     private String toManyProblem(HibernateToManyEntityProperty property) {
         PropertyConfig mapped = property.hibernateMappedForm
-        String writeProblem = writeRestrictionProblem(mapped)
-        if (writeProblem != null) {
-            return writeProblem
-        }
         CollectionKind kind = CollectionKind.of(property.type)
         if (kind == null) {
             return "the declared type [${property.type?.name}] is not one of 
Set, SortedSet, List or Collection, " +
@@ -1913,7 +1890,7 @@ class GrailsDomainGenerator {
         }
         PropertyConfig mapped = property.hibernateMappedForm
         if (inverseOneToOne) {
-            return writeRestrictionProblem(mapped)
+            return null
         }
         boolean compositeTarget = compositeIdentifier(target)
         if (compositeTarget) {
@@ -2274,13 +2251,19 @@ class GrailsDomainGenerator {
         return nullableInComponent(facets, enclosing)
     }
 
-    /** {@code ComponentUpdater} makes every column of an enclosing component 
nullable when that component is. */
+    /**
+     * {@code ComponentUpdater} makes every column of an enclosing component 
nullable when that component is. The binder also writes
+     * the component as a whole only when its property is insertable and 
updatable ({@code PropertyBinder}), so a column is written
+     * only when every enclosing embedded property allows it as well.
+     */
     private static ColumnFacets nullableInComponent(ColumnFacets facets, 
List<HibernateEmbeddedProperty> enclosing) {
         boolean nullable = facets.nullable() || enclosing.any { 
HibernateEmbeddedProperty e ->
             e.hibernateOwner.isComponentPropertyNullable(e)
         }
+        boolean insertable = facets.insertable() && enclosing.every { 
HibernateEmbeddedProperty e -> e.hibernateMappedForm?.insertable != false }
+        boolean updatable = facets.updatable() && enclosing.every { 
HibernateEmbeddedProperty e -> e.hibernateMappedForm?.updatable != false }
         return new ColumnFacets(
-                facets.name(), nullable, facets.unique(), facets.insertable(), 
facets.updatable(), facets.length(),
+                facets.name(), nullable, facets.unique(), insertable, 
updatable, facets.length(),
                 facets.precision(), facets.scale(), facets.sqlType(), 
facets.defaultValue(), facets.read(),
                 facets.write(), facets.comment())
     }
@@ -2308,10 +2291,6 @@ class GrailsDomainGenerator {
             return "the property is mapped with the type 
[${property.userType.name}]: the binder binds it as one simple value of that " +
                     'type and not as an embedded object, which the generator 
does not state'
         }
-        String writeProblem = 
writeRestrictionProblem(property.hibernateMappedForm)
-        if (writeProblem != null) {
-            return writeProblem
-        }
         if (visiting.contains(type.javaClass)) {
             return "the embedded type [${type.name}] contains itself"
         }
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/generated/GeneratedDomainClassesWriteFlagsSpec.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/generated/GeneratedDomainClassesWriteFlagsSpec.groovy
new file mode 100644
index 0000000000..35472e6cfa
--- /dev/null
+++ 
b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/generated/GeneratedDomainClassesWriteFlagsSpec.groovy
@@ -0,0 +1,269 @@
+/*
+ * 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
+ *
+ *   http://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.
+ */
+package grails.gorm.tests.generated
+
+import java.util.concurrent.atomic.AtomicInteger
+
+import grails.gorm.annotation.Entity
+import org.hibernate.mapping.Table
+import spock.lang.AutoCleanup
+import spock.lang.Specification
+import spock.lang.Unroll
+
+import org.grails.orm.hibernate.HibernateDatastore
+
+/**
+ * {@code insertable: false} and {@code updatable: false} on a property that 
has no column of its own. A collection and the
+ * inverse side of a one-to-one are written through their own tables or by the 
other side, so the domain binder writes them
+ * whatever the flags say, and the generated classes ignore the flags there 
the same way, instead of refusing the mapping. An
+ * embedded object is written through the columns of its properties, which the 
binder keeps out of the insert or the update, and so
+ * do the generated classes.
+ */
+class GeneratedDomainClassesWriteFlagsSpec extends Specification {
+
+    static final AtomicInteger BOOTS = new AtomicInteger()
+
+    @AutoCleanup
+    HibernateDatastore datastore
+
+    private HibernateDatastore boot(List<Class> group, boolean generated) {
+        datastore?.close()
+        datastore = new HibernateDatastore([
+                'dataSource.url'                  : 
"jdbc:h2:mem:gdw${BOOTS.incrementAndGet()};LOCK_TIMEOUT=10000".toString(),
+                'dataSource.dbCreate'             : 'create-drop',
+                'hibernate.generatedDomainClasses': generated,
+        ], group as Class[])
+        return datastore
+    }
+
+    private Map<String, Map> schema(List<Class> group, boolean generated) {
+        HibernateDatastore booted = boot(group, generated)
+        Map<String, Map> result = new TreeMap<String, Map>()
+        for (Table table : booted.metadata.collectTableMappings()) {
+            if (table.physicalTable) {
+                result[table.name] = [
+                        columns    : table.columns.collectEntries { 
org.hibernate.mapping.Column column ->
+                            [(column.name): 
"${column.getSqlType(booted.metadata)}${column.nullable ? '' : ' not 
null'}".toString()]
+                        },
+                        primaryKey : table.primaryKey?.columns*.name?.sort(),
+                        foreignKeys: table.foreignKeys.values().collect { 
"${it.columns*.name} -> ${it.referencedTable.name}".toString() }.sort(),
+                ]
+            }
+        }
+        return result
+    }
+
+    @Unroll
+    void "#label: the generated mode creates the schema of the domain 
binder"() {
+        expect:
+        schema(group, true) == schema(group, false)
+
+        where:
+        label                                   | group
+        'insertable false on a basic collection' | [GdwTagsOwner]
+        'updatable false on a basic collection'  | [GdwUpdTagsOwner]
+        'insertable false on a collection of entities' | [GdwItemsOwner, 
GdwItem]
+        'insertable false on an embedded object' | [GdwEmbeddedOwner]
+        'updatable false on an embedded object'  | [GdwUpdEmbeddedOwner]
+        'insertable false on a many-to-many'     | [GdwManyA, GdwManyB]
+        'insertable false on the hasOne side'    | [GdwHasOneOwner, 
GdwHasOneDetail]
+    }
+
+    @Unroll
+    void "#label: the property is written and updated in both modes, whatever 
the flag says"() {
+        when:
+        Map<Boolean, List> results = [false, true].collectEntries { boolean 
generated ->
+            boot(group, generated)
+            [(generated): this."${cycle}"()]
+        }
+
+        then:
+        results[true] == results[false]
+        results[true] == expected
+
+        where:
+        label                                   | group                        
  | cycle                | expected
+        'the tags with insertable false'        | [GdwTagsOwner]               
  | 'tagsCycle'          | [['a', 'b'], ['c']]
+        'the tags with updatable false'         | [GdwUpdTagsOwner]            
  | 'updTagsCycle'       | [['a', 'b'], ['c']]
+        'the items with insertable false'       | [GdwItemsOwner, GdwItem]     
  | 'itemsCycle'         | [['one', 'two'], ['three']]
+        'the embedded address with insertable false' | [GdwEmbeddedOwner]      
  | 'embeddedCycle'      | [null, 'avenue']
+        'the embedded address with updatable false'  | [GdwUpdEmbeddedOwner]   
  | 'updEmbeddedCycle'   | ['street', 'street']
+        'the many-to-many with insertable false' | [GdwManyA, GdwManyB]        
  | 'manyCycle'          | [['b1', 'b2'], ['b2', 'b3']]
+        'the hasOne detail with insertable false' | [GdwHasOneOwner, 
GdwHasOneDetail] | 'hasOneCycle'   | ['d1', 'd2']
+    }
+
+    private List tagsCycle() {
+        Long id = GdwTagsOwner.withTransaction { new GdwTagsOwner(tags: ['a', 
'b'] as Set).save(failOnError: true, flush: true).id }
+        List first = GdwTagsOwner.withNewSession { 
GdwTagsOwner.get(id).tags.sort() }
+        GdwTagsOwner.withTransaction { GdwTagsOwner owner = 
GdwTagsOwner.get(id); owner.tags = ['c'] as Set; owner.save(failOnError: true, 
flush: true) }
+        return [first, GdwTagsOwner.withNewSession { 
GdwTagsOwner.get(id).tags.sort() }]
+    }
+
+    private List updTagsCycle() {
+        Long id = GdwUpdTagsOwner.withTransaction { new GdwUpdTagsOwner(tags: 
['a', 'b'] as Set).save(failOnError: true, flush: true).id }
+        List first = GdwUpdTagsOwner.withNewSession { 
GdwUpdTagsOwner.get(id).tags.sort() }
+        GdwUpdTagsOwner.withTransaction { GdwUpdTagsOwner owner = 
GdwUpdTagsOwner.get(id); owner.tags = ['c'] as Set; owner.save(failOnError: 
true, flush: true) }
+        return [first, GdwUpdTagsOwner.withNewSession { 
GdwUpdTagsOwner.get(id).tags.sort() }]
+    }
+
+    private List itemsCycle() {
+        Long id = GdwItemsOwner.withTransaction {
+            GdwItem one = new GdwItem(name: 'one').save(failOnError: true)
+            GdwItem two = new GdwItem(name: 'two').save(failOnError: true)
+            new GdwItemsOwner(items: [one, two] as Set).save(failOnError: 
true, flush: true).id
+        }
+        List first = GdwItemsOwner.withNewSession { 
GdwItemsOwner.get(id).items*.name.sort() }
+        GdwItemsOwner.withTransaction {
+            GdwItem three = new GdwItem(name: 'three').save(failOnError: true)
+            GdwItemsOwner owner = GdwItemsOwner.get(id)
+            owner.items = [three] as Set
+            owner.save(failOnError: true, flush: true)
+        }
+        return [first, GdwItemsOwner.withNewSession { 
GdwItemsOwner.get(id).items*.name.sort() }]
+    }
+
+    private List embeddedCycle() {
+        Long id = GdwEmbeddedOwner.withTransaction { new 
GdwEmbeddedOwner(home: new GdwAddress(street: 'street')).save(failOnError: 
true, flush: true).id }
+        String first = GdwEmbeddedOwner.withNewSession { 
GdwEmbeddedOwner.get(id).home?.street }
+        GdwEmbeddedOwner.withTransaction { GdwEmbeddedOwner owner = 
GdwEmbeddedOwner.get(id); owner.home = new GdwAddress(street: 'avenue'); 
owner.save(failOnError: true, flush: true) }
+        return [first, GdwEmbeddedOwner.withNewSession { 
GdwEmbeddedOwner.get(id).home?.street }]
+    }
+
+    private List updEmbeddedCycle() {
+        Long id = GdwUpdEmbeddedOwner.withTransaction { new 
GdwUpdEmbeddedOwner(home: new GdwAddress(street: 'street')).save(failOnError: 
true, flush: true).id }
+        String first = GdwUpdEmbeddedOwner.withNewSession { 
GdwUpdEmbeddedOwner.get(id).home?.street }
+        GdwUpdEmbeddedOwner.withTransaction { GdwUpdEmbeddedOwner owner = 
GdwUpdEmbeddedOwner.get(id); owner.home = new GdwAddress(street: 'avenue'); 
owner.save(failOnError: true, flush: true) }
+        return [first, GdwUpdEmbeddedOwner.withNewSession { 
GdwUpdEmbeddedOwner.get(id).home?.street }]
+    }
+
+    private List manyCycle() {
+        Long id = GdwManyA.withTransaction {
+            GdwManyB one = new GdwManyB(name: 'b1').save(failOnError: true)
+            GdwManyB two = new GdwManyB(name: 'b2').save(failOnError: true)
+            new GdwManyA(bs: [one, two] as Set).save(failOnError: true, flush: 
true).id
+        }
+        List first = GdwManyA.withNewSession { 
GdwManyA.get(id).bs*.name.sort() }
+        GdwManyA.withTransaction {
+            GdwManyB three = new GdwManyB(name: 'b3').save(failOnError: true)
+            GdwManyA owner = GdwManyA.get(id)
+            owner.bs = [GdwManyB.findByName('b2'), three] as Set
+            owner.save(failOnError: true, flush: true)
+        }
+        return [first, GdwManyA.withNewSession { 
GdwManyA.get(id).bs*.name.sort() }]
+    }
+
+    private List hasOneCycle() {
+        Long id = GdwHasOneOwner.withTransaction {
+            GdwHasOneOwner owner = new GdwHasOneOwner(detail: new 
GdwHasOneDetail(label: 'd1'))
+            owner.save(failOnError: true, flush: true).id
+        }
+        String first = GdwHasOneOwner.withNewSession { 
GdwHasOneOwner.get(id).detail?.label }
+        GdwHasOneOwner.withTransaction {
+            GdwHasOneOwner owner = GdwHasOneOwner.get(id)
+            owner.detail.label = 'd2'
+            owner.save(failOnError: true, flush: true)
+        }
+        return [first, GdwHasOneOwner.withNewSession { 
GdwHasOneOwner.get(id).detail?.label }]
+    }
+}
+
+@Entity
+class GdwTagsOwner {
+    Set<String> tags
+    static hasMany = [tags: String]
+    static mapping = {
+        tags insertable: false
+    }
+}
+
+@Entity
+class GdwUpdTagsOwner {
+    Set<String> tags
+    static hasMany = [tags: String]
+    static mapping = {
+        tags updatable: false
+    }
+}
+
+@Entity
+class GdwItem {
+    String name
+}
+
+@Entity
+class GdwItemsOwner {
+    Set<GdwItem> items
+    static hasMany = [items: GdwItem]
+    static mapping = {
+        items insertable: false
+    }
+}
+
+class GdwAddress {
+    String street
+}
+
+@Entity
+class GdwEmbeddedOwner {
+    GdwAddress home
+    static embedded = ['home']
+    static mapping = {
+        home insertable: false
+    }
+}
+
+@Entity
+class GdwUpdEmbeddedOwner {
+    GdwAddress home
+    static embedded = ['home']
+    static mapping = {
+        home updatable: false
+    }
+}
+
+@Entity
+class GdwManyA {
+    Set<GdwManyB> bs
+    static hasMany = [bs: GdwManyB]
+    static mapping = {
+        bs insertable: false
+    }
+}
+
+@Entity
+class GdwManyB {
+    String name
+    Set<GdwManyA> owners
+    static hasMany = [owners: GdwManyA]
+    static belongsTo = [GdwManyA]
+}
+
+@Entity
+class GdwHasOneOwner {
+    static hasOne = [detail: GdwHasOneDetail]
+    static mapping = {
+        detail insertable: false
+    }
+}
+
+@Entity
+class GdwHasOneDetail {
+    String label
+    GdwHasOneOwner owner
+}
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/jpa/GrailsDomainGeneratorOptionCoverageSpec.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/jpa/GrailsDomainGeneratorOptionCoverageSpec.groovy
index 41f088f26f..0f1c2aa71a 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/jpa/GrailsDomainGeneratorOptionCoverageSpec.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/jpa/GrailsDomainGeneratorOptionCoverageSpec.groovy
@@ -60,6 +60,12 @@ class GrailsDomainGeneratorOptionCoverageSpec extends 
GrailsDomainGeneratorSuppo
 
     private static final List<String> SIMPLE = ['basic', 'number', 'mode']
 
+    /** The kinds of property that have a column of their own, where the write 
flags can be stated. */
+    private static final List<String> COLUMN_KINDS = ['basic', 'number', 
'mode', 'target', 'home']
+
+    /** The kinds of property that have no column of their own: the domain 
binder ignores the write flags there, and so does the generator. */
+    private static final List<String> NO_COLUMN_KINDS = ['tags', 'modes', 
'targets', 'ordered']
+
     private static final List<String> COLLECTIONS = ['tags', 'modes', 
'targets', 'ordered']
 
     private static final List<String> VALUE_COLLECTIONS = ['tags', 'modes', 
'ordered']
@@ -82,8 +88,8 @@ class GrailsDomainGeneratorOptionCoverageSpec extends 
GrailsDomainGeneratorSuppo
             // a unique group on a collection property names columns of the 
owner's table, which the collection table does not have: the binder's
             // key over them cannot be created (a defect fixed on the 8.0.x 
line), so the generator deliberately states none
             'property.uniqueGroup'         : ['basic', 'number', 'mode', 
'target'],
-            'property.insertable'          : KINDS,
-            'property.updatable'           : KINDS,
+            'property.insertable'          : COLUMN_KINDS,
+            'property.updatable'           : COLUMN_KINDS,
             'property.type'                : ['basic'],
             'property.typeClass'           : ['basic', 'number', 'mode', 
'home', 'tags', 'modes', 'targets', 'ordered'],
             'property.derived'             : ['basic', 'number', 'mode', 
'target'],
@@ -121,6 +127,15 @@ class GrailsDomainGeneratorOptionCoverageSpec extends 
GrailsDomainGeneratorSuppo
             'mapping.userTypes'            : ['mapping'],
     ]
 
+    /**
+     * Option to the kinds where the domain binder reads it and ignores it all 
the same (it overwrites the flags with the ones of the
+     * columns, and these kinds have none of their own): the generator ignores 
it there too, and does not refuse the mapping.
+     */
+    private static final Map<String, List<String>> IGNORED_LIKE_THE_BINDER = [
+            'property.insertable': NO_COLUMN_KINDS,
+            'property.updatable' : NO_COLUMN_KINDS,
+    ]
+
     /** Options that change nothing anywhere, and why that is no silent drop. 
*/
     private static final Map<String, String> NEVER_HAS_EFFECT = [
             'property.accessType'          : 'run time: how the entity 
instance is read and written, which a generated metadata class never does',
@@ -161,6 +176,16 @@ class GrailsDomainGeneratorOptionCoverageSpec extends 
GrailsDomainGeneratorSuppo
         } == []
     }
 
+    void "a write flag on a property with no column is accepted and changes 
nothing, as the domain binder ignores it"() {
+        given:
+        Map<String, Map<String, String>> verdicts = verdicts()
+
+        expect:
+        IGNORED_LIKE_THE_BINDER.collectMany { String option, List<String> 
kinds ->
+            kinds.findAll { String kind -> verdicts[option][kind] != 'ignored' 
}.collect { String kind -> "${option} on ${kind}: 
${verdicts[option][kind]}".toString() }
+        } == []
+    }
+
     void "no mutation breaks the generator with something other than a 
rejection"() {
         given:
         Map<String, Map<String, String>> verdicts = verdicts()
@@ -210,23 +235,21 @@ class GrailsDomainGeneratorOptionCoverageSpec extends 
GrailsDomainGeneratorSuppo
         read.customWrite == 'upper(?)'
     }
 
-    void "an insertable or updatable flag on a property with no column is 
rejected by name"() {
-        when:
-        generateGroup(GenCovOwner, GenCovTarget)
+    void "an insertable or updatable flag on a property with no column is 
accepted and ignored"() {
+        given:
+        String base = signature()
         
entity(GenCovOwner).getHibernatePropertyByName(property).hibernateMappedForm.insertable
 = false
-        generateGroup(GenCovOwner, GenCovTarget)
+        
entity(GenCovOwner).getHibernatePropertyByName(property).hibernateMappedForm.updatable
 = false
 
-        then:
-        UnsupportedOperationException e = thrown()
-        e.message.contains('GenCovOwner')
-        e.message.contains(property)
-        e.message.contains('insertable: false or updatable: false')
+        expect:
+        signature() == base
 
         cleanup:
         
entity(GenCovOwner).getHibernatePropertyByName(property).hibernateMappedForm.insertable
 = true
+        
entity(GenCovOwner).getHibernatePropertyByName(property).hibernateMappedForm.updatable
 = true
 
         where:
-        property << ['home', 'tags', 'targets']
+        property << ['tags', 'targets']
     }
 
     void "a user type mapped on an embedded property is rejected by name, 
because the binder binds it as a simple value"() {
diff --git 
a/grails-data-hibernate7/docs/src/docs/asciidoc/advancedGORMFeatures/nativeDomainBinding.adoc
 
b/grails-data-hibernate7/docs/src/docs/asciidoc/advancedGORMFeatures/nativeDomainBinding.adoc
index edec11f96a..d638353a6b 100644
--- 
a/grails-data-hibernate7/docs/src/docs/asciidoc/advancedGORMFeatures/nativeDomainBinding.adoc
+++ 
b/grails-data-hibernate7/docs/src/docs/asciidoc/advancedGORMFeatures/nativeDomainBinding.adoc
@@ -68,6 +68,7 @@ For the domain classes in GORM's own test suites, both 
bindings produce the same
 * A registered type name for a different Java type than the property's, for 
example `type: 'string'` on an `Integer`, gives the column of the registered 
type (`varchar(255)`), as with classic binding. Neither binding converts the 
value, so saving a value that is not null fails with a `ClassCastException` in 
both; a null value and the other properties of the class are stored.
 * A natural id (`id natural: [...]`) may name an embedded object (the unique 
key spans its columns, in the order of the embedded class), and a name that is 
no property of the class is skipped without a message, as with classic binding.
 * A natural id declared on a subclass adds a unique key to the table of the 
hierarchy (the table of the subclass in a joined hierarchy), over the columns 
of the named properties in the order the mapping names them, and makes those 
properties updatable only when the natural id is `mutable`. Classic binding 
also marks the properties as natural identifiers, and with Hibernate 7 that 
makes every load of the subclass entity fail with a `NullPointerException`; 
native binding does not mark them [...]
+* `insertable: false` and `updatable: false` are honored on a property with a 
column. On an embedded object they apply to every column of the object. On a 
`hasMany` and on the inverse side of a one-to-one (the side with no column) 
both bindings ignore them: the collection is written through its own table, and 
the foreign key lives on the other side.
 * Identifier generators, inheritance strategies (single table, joined and 
table-per-concrete-class), discriminators, natural ids, optimistic locking, 
lazy and eager fetching, cascades, sorting, batch size and `cache` usage are 
mapped as with classic binding.
 
 [[nativeDomainBinding-refused]]
@@ -95,10 +96,6 @@ Nothing is ignored silently. A mapping that boots is bound 
the way it is written
 | `Collection property [...]: the type [...] mapped on the collection property 
names neither a class nor serializable ...` or `... a custom collection type (a 
UserCollectionType) is mapped on a collection of basic values ...`
 | Remove the `type`, or use `'serializable'` or a `UserType` class to store 
the collection in one column. Classic binding does not boot with a registered 
type name (it fails with `Could not load requested class`), and neither with a 
custom collection type on a collection of basic values.
 
-| `insertable: false` or `updatable: false` on a property that has no column 
of its own: a collection, an embedded object, or the inverse side of a 
one-to-one.
-| `... insertable: false or updatable: false is mapped on a property that has 
no column of its own ...`
-| Remove the option. Classic binding ignores it on such a property. On a 
property with a column, both bindings honor it.
-
 | A `discriminator` column with `precision` or `scale`.
 | `The discriminator column of [...] sets a precision or a scale, which 
@DiscriminatorColumn cannot state`
 | Remove them. Use `length` to size the column.

Reply via email to