(Quick Reference)

dynamicUpdate

目的
Purpose

Whether to dynamically build UPDATE queries

使用例
Examples

class Book {

...

static mapping = { dynamicUpdate true } }

詳細
Description

Usage: dynamicUpdate(boolean)
使用方法:
Usage:
dynamicUpdate(boolean)

By default Hibernate generates all queries at startup and caches them. This helps performance since insert, update, and delete queries don't have to be dynamically generated at runtime. However, there are certain circumstances where dynamic queries are useful.

For example if you were using custom UserType to hash passwords, every time an UPDATE occurred, the password would get re-hashed. The dynamicUpdate method lets you turn off the dynamic creation of queries that uses only the properties that are needed to perform the update.