GORM validation gotcha

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

GORM validation gotcha

Dierk König

we ran into the following situation

class DomainA {
    // using custom validator that fails when
    // some unreferenced obj has been deleted

class DomainB {
   static belongsTo = DomainA

Objects of domain A and B are all happily saved.
Now, when domainA suddenly becomes invalid
(because some other totally unrelated object has been
deleted), and we try
nothing is persisted to the database (which is fine)
but we don't get any error indication whatsoever -
no return value of false, no error object, no Exception.

Since GORM obviously knows about the failing
validation for domainA, it would be very convenient
to get an error indication.

Shall I file a feature request?

NB: We're well aware our custom validator is a bad
idea and the design is very unfortunate. We know, that
we can call domainA.domainB.validate() ourselves.
However, in this corner case, save() yields misleading


To unsubscribe from this list, please visit: