(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-reads 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. However this method is useful in certain special circumstances. For example

  • where a database trigger alters the object state upon insert or update
  • after executing direct SQL (e.g. a bulk update) in the same Session
  • after inserting a Blob or Clob