我有一个域类DefectData
如下
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”。我只想根据月份和年份列出记录。
可能是什么问题?