Home Grails 3.3.2 domain classes inheritance issue
Reply: 0

Grails 3.3.2 domain classes inheritance issue

user1333 Published in April 24, 2018, 8:17 am

I've been migrating from Grails 3.2.11 to 3.3.2 and faced an odd issue:

If domain class inherits from a class from src/main/groovy - it's created and saved into DB properly at a first time. But when you retrieve it from DB and try to update the inherited properties - they are not saved back to DB.


abstract class AbstractTest {
    String field

class Test extends AbstractTest {

    static constraints = {

If you run the following script in grails console it will print the correct values but if you check the DB - an old value (set at the time of creation) is stored:

import testapp.Test

new Test(field: 'original').save(flush: true)
Test test = Test.list().find()
println test.properties
test.field = 'modified'
println test.save(flush: true)
test = Test.list().find()
println test.properties

See https://github.com/ahlinist/testGorm

I use mysql, login: 'root', no pass

JDBC logging (logSql: true) discovered that no update query is sent to DB but the in-memory state (e.g. Test.list()*.properties) works as if the inherited property has been updated successfully.

Updating of ancestor's properties worked fine in 3.2.11. Couldn't find any answer in the documentation. What am I missing?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322225 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO