开发者

Get/findById returns null in Bootstrap

when i try to get an object in the bootstrap via User.get(1) or User.findBy开发者_如何学运维Id(1) I get always null returned. I saved the object before with new User(...).save(flush: true) and the user is already in User.list()...

who knows the reason/mistake?

thx


The domain is probably not being saved due validation errors.

replace your

user.save(flush:true)

for

if (user.validate()) {
  user.save(flush:true)
} else {
  user.errors.allErrors.each { println it }
}

It will print all validation errors in your console.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜