spring-attic/grails-data-mapping

transient property not validating

Closed this issue · 2 comments

I have a domain class:

class Book {

String id 
Date dateCreated
Date lastUpdated
String title
boolean acceptPolicy // defines if the user accepts the terms and privacy poicy
String uploadImageId

static transients = [ "acceptPolicy" ]  

static constraints = {
    acceptPolicy( validator: { val, obj -> val == true} )
}
}

I choose "acceptPolicy" as a field which should not be stored in the database. When I create a book object everything works find. The problem occurs when I update the book instance. Every time I try to save I get a validation error for the "acceptPolicy". This should not be the case because "acceptPolicy" is not stored in the database. I also tried to set the

acceptPolicy = true 

in a hidden input field but still this problem occurs. How can I fix it?

which datastore are you refering to?

I use the grails mongodb plugin!