12.2.2 Configuring Hibernate
Setting up a Hibernate/JPA EntityManager
Using the CLI If you are creating your project using the Micronaut CLI, supply the
|
Micronaut features built in support for configuring a Hibernate / JPA EntityManager
that builds on the SQL DataSource support.
Once you have configured one or many DataSources to use Hibernate, you will need to add the hibernate-jpa
dependency to your build configuration:
implementation("io.micronaut.sql:micronaut-hibernate-jpa")
<dependency>
<groupId>io.micronaut.sql</groupId>
<artifactId>micronaut-hibernate-jpa</artifactId>
</dependency>
For more information see the Configuring Hibernate section of the Micronaut SQL libraries project.
Using GORM for Hibernate
For Groovy users and users familiar with the Grails framework, special support for GORM for Hibernate is available. To use GORM for Hibernate you should not include Micronaut’s built in SQL Support or the hibernate-jpa
dependency since GORM itself takes responsibility for creating the DataSource
, SessionFactory
etc.
Using the CLI If you are creating your project using the Micronaut CLI, supply the
|
See the GORM Modules section of the Micronaut for Groovy user guide.