# lazy

## Purpose

Configures whether to use lazy proxies for one-to-one and many-to-one associations.

## Examples

    class Book {
        static belongsTo = [author:Author]
        static mapping = {
            author lazy:false
        }
    }

## Description

Usage: `association_name(lazy:boolean)`

By default GORM single-ended associations are lazy in that when you load a domain instance an associated domain is not loaded until accessed. Hibernate creates a dynamic proxy by automatically subclassing a domain instance and proxying all methods and property access.

This can have some strange side effects (see this page on proxies on the Hibernate site) particularly in relation to inheritance. You can tell Hibernate not use proxies for single-ended associations by using the `lazy` argument:

    static mapping = {
        author lazy:false
    }

See the section on Eager vs Lazing Fetching in the user guide.