(Quick Reference)

autoImport

Purpose

Enable/disable auto import of this domain classes in HQL queries.

Examples

class Book {
    …
    static mapping = {
        autoImport false
    }
}

Description

Usage: autoImport(boolean)

By default the domain classes are auto-imported in HQL queries, but sometimes you have duplicated domain class names in different packages of your project causing a org.hibernate.DuplicateMappingException. So you need to disable auto-import of one of them configuring autoImport to false. Remember that you need to use the fully qualified class name in the HQL query for references to these classes.

static mapping = {
    autoImport false
}