1.

How Do You Configuring Eager Fetching In A Domain Class?

Answer»

using:

LAZY: FALSE
or
fetch: 'join'

Example:

CLASS AIRPORT {
String name
static hasMany = [flights: Flight]
static mapping = {
flights lazy: false //here you configure eager fetching
}
}

class Person {
String firstName
Pet pet
static hasMany = [addresses: Address]
static mapping = {
addresses lazy: false
pet fetch: 'join' //this is ANOTHER way to configure eager fetching
}
}

using:

lazy: false
or
fetch: 'join'

Example:

class Airport {
String name
static hasMany = [flights: Flight]
static mapping = {
flights lazy: false //here you configure eager fetching
}
}

class Person {
String firstName
Pet pet
static hasMany = [addresses: Address]
static mapping = {
addresses lazy: false
pet fetch: 'join' //this is another way to configure eager fetching
}
}



Discussion

No Comment Found