У меня есть 2 домена:
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
}
и:
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
}
}
И этот запрос:
selected = JobProcess.withCriteria{
like("scriptUser", "%${params.name}%")
maxResults(params.max as int)
firstResult(params.offset? params.offset.toInteger():0)
}
Я получаю ошибки:
ERROR property.BasicPropertyAccessor - IllegalArgumentException in class: common.User, getter method of property: id
ERROR errors.GrailsExceptionResolver - java.lang.ClassCastException@503ca729
Я также пытаюсь заменить аналогичные детали на:
eq("scriptUser", 1)
, но я получаю те же ошибки.
Что не так?Есть идеи?