////
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.
////


== hibernate



=== Purpose


The `hibernate` plugin configures the Hibernate implementation of link:{guidePath}GORM.html[GORM].


=== Examples


An example domain class:

[source,groovy]
----
class Book {
    String title
    Date releaseDate
    Author author
}
----


=== Description


Refer to the section on link:{guidePath}GORM.html[GORM] in the Grails user guide which details how to create Grails domain classes.

Configured Spring Beans:

* `dialectDetector` - An instance of link:{apiFromRef}org/grails/orm/hibernate/support/HibernateDialectDetectorFactoryBean.html[HibernateDialectDetectorFactoryBean] that attempts to automatically detect the Hibernate https://javadoc.io/doc/org.hibernate/hibernate-core/{hibernate5Version}/org/hibernate/dialect/Dialect.html[Dialect] which is used to communicate with the database.
* `hibernateProperties` - A `Map` of Hibernate properties passed to the `SessionFactory`
* `sessionFactory` -  An instance of the Hibernate https://javadoc.io/doc/org.hibernate/hibernate-core/{hibernate5Version}/org/hibernate/SessionFactory.html[SessionFactory] class
* `transactionManager` - An instance of Spring's {springapi}org/springframework/orm/hibernate5/HibernateTransactionManager.html[HibernateTransactionManager] class
* `persistenceInterceptor` - An instance of link:{apiFromRef}org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html[HibernatePersistenceContextInterceptor] that abstracts away how persistence is used from the controller/view layer so that Grails can be used without GORM.
* `openSessionInViewInterceptor` - An instance of link:{apiFromRef}org/grails/datastore/mapping/web/support/OpenSessionInViewInterceptor.html[GrailsOpenSessionInViewFilter] that deals with Grails' https://javadoc.io/doc/org.hibernate/hibernate-core/{hibernate5Version}/org/hibernate/Session.html[Session] management.
