grails事务服务未保存域对象[v2.5.6]
我有一个grails(版本2.5.6)服务创建并试图保存一个域对象。 虽然它回答保存的对象,但我不会在db或query中检索它 我已设定: Config.groovy中的grails.gorm.failOnError=true 静态事务=在服务中为truegrails事务服务未保存域对象[v2.5.6],grails,transactions,gorm,ehcache,Grails,Transactions,Gorm,Ehcache,我有一个grails(版本2.5.6)服务创建并试图保存一个域对象。 虽然它回答保存的对象,但我不会在db或query中检索它 我已设定: Config.groovy中的grails.gorm.failOnError=true 静态事务=在服务中为true biz.Forecast forecast = new biz.Forecast() forecast.security = security forecast.estimation = somevalue forecast.era = (e
biz.Forecast forecast = new biz.Forecast()
forecast.security = security
forecast.estimation = somevalue
forecast.era = (era2 - 1)
forecast.maxdate = nth.toInteger()
forecast.dateOfVolume = dtfOut.print(new DateTime().minusDays((era2 - 1)))
forecast.save(flush: true)
log.error(forecast.errors)
log.error(forecast)
grails.validation.ValidationErrors:0个错误
安全性:ACA——日期:2019-09-06——最长日期:24
编辑:域类:biz.Forecast
package biz
class Forecast {
static hasOne = [security:Security]
// era is 24 or 72
int era
// maxdate is
int maxdate
String dateOfVolume
double estimation
static constraints = {
}
String toString(){
return "Security: ${security.name} -- date: ${dateOfVolume} -- maxDate: ${maxdate}"
}
}
还有商业安全
package biz
import java.math.BigDecimal;
class Security {
String name
String description
String exchange
String type
String full_name
static hasMany = [infos: Information,forecasts:Forecast]
public String toString(){
return "${name}- ${exchange}--${full_name}"
}
static constraints = {
name nullable: false,blank: false,unique: true
exchange nullable: false,blank: false
type nullable: false,blank: false
description blank: true,nullable: true
full_name nullable: false,blank: false
}
}