In Grails / GORM, what is the difference between static mapping = {xyz lazy: false}
& static fetchMode = [xyz: 'eager']
?
Example:
class Book {
static belongsTo = [author: Author]
static mapping = {author lazy: false}
static fetchMode = [author: 'eager']
}
GORM is the data access toolkit used by Grails and provides a rich set of APIs for accessing relational and non-relational data including implementations for Hibernate (SQL), MongoDB, Neo4j, Cassandra, an in-memory ConcurrentHashMap for testing and an automatic GraphQL schema generator.
A domain class fulfills the M in the Model View Controller (MVC) pattern and represents a persistent entity that is mapped onto an underlying database table. In Grails a domain is a class that lives in the grails-app/domain directory.
The difference between lazy:false and fetchMode 'eager' are
Should you be interested in a detailed explanation about Fetchmodes, take a look http://www.solidsyntax.be/2013/10/17/fetching-collections-hibernate/. The article describes the Hibernate fetchmodes and the output which they produce.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With