(Quick Reference)
refresh
Purpose
Refreshes a domain classes state from the database
Examples
def b = Book.get(1)
b.refresh()
Description
Equivalent to the Hibernate
refresh method.
Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. For example
- where a database trigger alters the object state upon insert or update
- after executing direct SQL (eg. a mass update) in the same session
- after inserting a Blob or Clob