(Quick Reference)
dynamicUpdate
Purpose
Whether to dynamically build
UPDATE
queries
Examples
class Book {
static mapping = {
dynamicUpdate true
}
}
Description
Usage:
dynamicUpdate(boolean)
By default Hibernate will build all queries at start-up time and cache them, which represents a significant performance gain as 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 allows you to turn of the dynamic creation of queries that uses only the properties that are needed to perform the update.