I have 2 domains :
class JobProcess {
static constraints = {
scriptUser(blank:false)
scriptType()
scriptName()
scriptPath()
scriptArgs(size:0..1000,nullable:true)
scriptDateCreated(nullable:true)
scriptDateStarted(nullable:true)
scriptDateFinished(nullable:true)
scriptRun()
scriptId()
}
static mapping = {
version false
}
User scriptUser
String scriptType
String scriptName
String scriptPath
String scriptArgs
Date scriptDateCreated
Date scriptDateStarted
Date scriptDateFinished
String scriptRun
int scriptId
}
and :
class User {
static hasMany = [ jobs : JobProcess ]
static constraints = {
login(unique: true, blank: false)
password(password: true, blank: false)
email(blank: false, emailAddr: true, maxSize: 50)
firstName(blank:false, maxSize:32)
lastName(blank:false, maxSize:32)
phoneNo(nullable: true)
}
static mapping = {
sort lastName: 'asc'
}
String login
String firstName
String lastName
String phoneNo
String email
String password
boolean locked = false
String toString()
{
if (firstName == "")
return email
return fullName()
}
String fullName()
{
return firstName + " " + lastName
}
}
And this query :
selected = JobProcess.withCriteria{
like("scriptUser", "%${params.name}%")
maxResults(params.max as int)
firstResult(params.offset? params.offset.toInteger():0)
}
I get errors :
ERROR property.BasicPropertyAccessor - IllegalArgumentException in class: common.User, getter method of property: id
ERROR errors.GrailsExceptionResolver - java.lang.ClassCastException@503ca729
I also try by replacing like part by :
eq("scriptUser", 1)
but I get same errors.
What's wrong ? Any ideas ?