关于grails的问题
首先是我的两个领域类:packageracesclassRegistration{RaceraceStringnameDatedateOfBirthStringgende...
首先是我的两个领域类:
package races
class Registration {
Race race
String name
Date dateOfBirth
String gender='F'
String postalAddress
String emailAddress
Date createAt=new Date()
static belongsTo=Race
static optionals=["postalAddress"]
static constraints={
name(maxLength:50,blank:false)
dateOfBirth(nullable:false)
gender(inList["M","F"])
postalAddress(maxLength:255)
emailAddress(maxLength:50,email:true)
race(nullable:false)
createAt()
}
}
========================================
package races
class Race {
String name
Date startDateTime
String city
String state
Float distance
Float cost
Integer maxRunners=100000
static hasMany=[registrations:Registration]
static constraints={
name(maxLength:50,blank:false)
startDateTime(validator:{return (it > new Date())})
city(maxLength:30,blank:false)
state(inList:['GA','NC','SC','VA'],blank:false)
distance(min:3.1f,max:100f)
cost(min:0f,max:999.99f)
maxRunners()
}
}
所报的错误是没有相关属性races.Registration,我想说,我又这个类啊,为什么还包这个错误?我只是想实现基本的增删改查,还有一些校验,脚手架的配置没问题的,这个是我跟着《grails入门》练习的时候遇到的问题 展开
package races
class Registration {
Race race
String name
Date dateOfBirth
String gender='F'
String postalAddress
String emailAddress
Date createAt=new Date()
static belongsTo=Race
static optionals=["postalAddress"]
static constraints={
name(maxLength:50,blank:false)
dateOfBirth(nullable:false)
gender(inList["M","F"])
postalAddress(maxLength:255)
emailAddress(maxLength:50,email:true)
race(nullable:false)
createAt()
}
}
========================================
package races
class Race {
String name
Date startDateTime
String city
String state
Float distance
Float cost
Integer maxRunners=100000
static hasMany=[registrations:Registration]
static constraints={
name(maxLength:50,blank:false)
startDateTime(validator:{return (it > new Date())})
city(maxLength:30,blank:false)
state(inList:['GA','NC','SC','VA'],blank:false)
distance(min:3.1f,max:100f)
cost(min:0f,max:999.99f)
maxRunners()
}
}
所报的错误是没有相关属性races.Registration,我想说,我又这个类啊,为什么还包这个错误?我只是想实现基本的增删改查,还有一些校验,脚手架的配置没问题的,这个是我跟着《grails入门》练习的时候遇到的问题 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询