Grails domain.get(PK) get old data

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Grails domain.get(PK) get old data

sereyvuth sok
I'm new in grails. Currently i use grails version 2.5.1.

My problem is when I update domain object. I call the domain by domain.get(PK) 
but it got old data. So when i save it throw StaleExeption.
My Code:
Book book = Book.get(bookId)
book.addToAuthor(new Author(name='John'))
book.save(flush: true)






--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/0788c15a-ea31-4e85-b6c2-da4b2b9fbe20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.