Situation :
I send a request using Grails resource and service named firstService;
First request's task is
book1.save(flush: true);
But when I save with book1.save(flush: true);
it does not save instantly and thats why withing 60 sec the second request can not find that book1 instance;
Second request's task is only updating data of first request.
How can I solve the problem ?
book1.save() do not returns true
, returns itself (book1) or returns null when errors.
There are four ways of to tell if object can be saved
validate
method before save. It should to return true hasErrors
property before save. It should to return false save
method returns the instance if all is ok save
method with (failOnError: true)
argument raise an error when validation fails If you're totally certain that the object was saved then check this:
setup
method to create it Note: Every Grails developer must to read the @pledbrook articles GORM Gotchas
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.