1
我有一個域類DefectData
如下namedQueries錯誤的Grails
class DefectData {
String taskId
String defectId
String defectSummary
String severity
String phaseDetected
String rejected
String loggedBy
String howFound
Date dateFound
String defectType
String defectCause
ProgressData progressData
def DefectData(){}
static constraints = {
id generator:"assigned",name:"defectId"
}
static belongsTo=[taskId:ProgressData]
static namedQueries={
getDefectDataByYearMonth{int month,int year ->
def plannedDate=Date.parse("mm-yy","${month} - ${year}")
}
}
}
我想這種查詢,這將使我能夠得到其中在「測試」階段中檢測到的缺陷數。
def testingDefects(int month,int year){
countTestingDefects=DefectData.getDefectDataByYearMonth(month,year).findAllWhere(phaseDetected:"Testing").count()
println countTestingDefects
}
雖然,我得到這個錯誤,該日期是不可解析
testingDefects(03,2012)
無法解析日期 「3-12」。我只是想根據月份和年份列出記錄。
可能是什麼問題?