cascading validation with annotated hibernate entities?

13 views
Skip to first unread message

zyro

unread,
Jul 28, 2014, 3:15:23 AM7/28/14
to grails-de...@googlegroups.com
hi,

how to get cascading validation to work with annotated hibernate
entities (JPA annotations / hibernate.cfg.xml)?

as i read the code, i think there is the following issue:

GrailsDomainClassValidator.cascadeValidationToOne(...) checks if the
entity being validated is the owning side of the association or if a
explicit cascading behavior has been defined via mapping dsl:

https://github.com/grails/grails-core/blob/master/grails-validation/src/main/groovy/org/grails/validation/GrailsDomainClassValidator.java#L235

but AbstractGrailsHibernateDomainClass.isOwningClass(...) statically
returns false and
GrailsHibernateDomainClassProperty.explicitSaveUpdateCascade is not set
as well (but the cascading behavior is defined via JPA annotations to ALL).

https://github.com/grails/grails-data-mapping/blob/master/grails-datastore-gorm-hibernate-core/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/AbstractGrailsHibernateDomainClass.java#L175

hence, GrailsDomainClassValidator always returns at that point and
validation seems to be never applied to associated entities.

thanks, zyro
Reply all
Reply to author
Forward
0 new messages