I have 2 domain objects, A and B. A has a B property and B belongsTo A.
If the B object validation fails when editing an A, it fails silently. The fields that fail validation simply revert to their old values.
Based on this, it appears that belongsTo isn't working properly in Grails 2.0 (we didn't have this problem with Grails 1.3.7 ). If anyone is aware of a workaround I'd appreciate it. I'm currently on Grails 2.0.1
Thanks Will but that still doesn't explain why this works in Grails 1.3.7 but not in Grails 2.0.
I seem to remember reading that Grails 2.0 is using a stricter version of Hibernate that Grails 1.3.7 so I'm wondering if this may be causing the problem. Has anyone else had any problems with one-to-one relationship validation with the stricter version of Hibernate or is just affecting me?
again somewhere in the documentation it says there was a chnage in behviour - where the validation would fail but the vlaues would still be wrriten in 1.3.7 - and i i believe v2 declared as an erroneous behaviour -
you should not persist values known to have failed validation - hence the change in behaviour
I think you must be misunderstanding my question. I realize that you don't want to persist values that fail validation. My point is that in a one-to-one relationship in Grails 1.3.7, if the ownee class (the class with the belongTo in it) fails validation when saving the owner class, an error is thrown, which can then be displayed to the user so he is aware of it. With Grails 2.0, however, if the ownee class fails validation when saving the owner class, the validation fails silently in that the fields where the validation failed simply revert to their old values.