cascading validation with annotated hibernate entities?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

cascading validation with annotated hibernate entities?

zyro
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

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/53D5F883.2080508%40zyro.net.
For more options, visit https://groups.google.com/d/optout.