Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.0.1
-
Fix Version/s: 1.0.2
-
Component/s: None
-
Labels:None
-
Environment:Linux/WinXP, Eclipse 3.3+
Description
The injected validation() method of a domain class is called only, when the injected save() or update() methods are called.
If none of Grails' dynamic methods is called explicitly, then validation() is not performed upon hibernate's session flushing / TX's commit.
Instead, the low-level DB's constraint-violation exceptions are thrown, and they are more difficuilt to catch.
Example:
class MyController{
def updateAttribute = {
def attribute = Attribute.get( params.id )
attribute.nameToken = params.nameToken
render( template:'attribute', model:[ attributes:(category.attributes) ] )
}
}
It shall be possible to call the Grails validation on "before-update/insert" automatically, and populate errors object and eventully delegate to a certain error-handler
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
This is by design, the solution is always to call save()