////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////


== autoImport



=== Purpose


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


=== Examples


[source,groovy]
----
class Book {
    ...
    static mapping = {
        autoImport false
    }
}
----


=== Description


Usage: `autoImport(boolean)`

By default the domain classes are auto-imported in HQL queries so you aren't required to specify the whole class name including the package, but if you have duplicate domain class names in different packages the names are no longer unique, causing a `org.hibernate.DuplicateMappingException`. Disable auto-import of one or both of them to fix this, setting `autoImport` to `false`. Remember that you need to use the fully qualified class name in the HQL query for references to these classes.

[source,groovy]
----
static mapping = {
    autoImport false
}
----
