I am just getting started with Grails and have a general question about adding constraints.
I have a simple domain class that I am building as part of following an Example application in Getting Started with Grails 2nd edition.
package racetrack
This code works fine, my question is when I first added the inList and the other constraints to the domain class while the server was running I began experiencing errors about hibernate sessions not being available and messages about state not being a property on the domain class. Is it always necessary to restart your server when adding constraints to domain classes? The messages that dump out don't point in that direction, but restarting the server seems to fix the problems and the scaffold code works as expected. Maybe its tied to the fact that I am using scaffold? Just a curious newb.
Thanks in advance for any pointers.
I have a simple domain class that I am building as part of following an Example application in Getting Started with Grails 2nd edition.
package racetrack
Code:
class Race {
String name
Date startDate
String city
String state
BigDecimal distance
BigDecimal cost
Integer maxRunners = 100000
static constraints = {
name blank:false, maxSize:50
startDate blank:true
city blank:true
state blank:false, inList: ["VA", "FL", "NY"]
distance min: 0.0
cost min: 0.0, max: 100.0
maxRunners min: 0, max: 100000
}
static mapping = {
sort "startDate"
}
}
package racetrack
class RaceController {
static scaffold = true
}
This code works fine, my question is when I first added the inList and the other constraints to the domain class while the server was running I began experiencing errors about hibernate sessions not being available and messages about state not being a property on the domain class. Is it always necessary to restart your server when adding constraints to domain classes? The messages that dump out don't point in that direction, but restarting the server seems to fix the problems and the scaffold code works as expected. Maybe its tied to the fact that I am using scaffold? Just a curious newb.
Thanks in advance for any pointers.