Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable deepvalidate in grails globally?

How can we disable deepvalidate on global level in grails3 as in our case on saving one domain object its trying to save all internal domain objects leading to different errors like unique constraint and all.

We are using mongodb

Grails version 3.3.2

Gorm Version 6.1.9.Release

like image 307
Kapil Arora Avatar asked Sep 17 '25 07:09

Kapil Arora


1 Answers

Globally disable cascadeValidate in Grails 3 or 4:

grails-app/conf/application.groovy

grails.gorm.default.mapping = {
    '*'(cascadeValidate: 'none')
    // Alternatively, validate nested changed objects:
    // '*'(cascadeValidate: 'dirty')
}

Reference: https://gorm.grails.org/latest/hibernate/manual/
Section: 13.3. Cascade constraints validation

like image 80
Al Belsky Avatar answered Sep 21 '25 12:09

Al Belsky