"Fossies" - the Fresh Open Source Software Archive

Member "grails-core-5.2.4/grails-docs/src/test/resources/docs/ref/Database Mapping/dynamicInsert.html" (14 Sep 2022, 59201 Bytes) of package /linux/www/grails-core-5.2.4.tar.gz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the grails-core-5.2.4.tar.gz project site itself.

(Quick Reference)



Whether to dynamically build INSERT queries


class Book {

    static mapping = {
        dynamicInsert true


Usage: dynamicInsert(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 dynamicInsert method lets you turn off the dynamic creation of queries that uses only the properties that are needed to perform the insert.