# 15. Grails and Hibernate

If GORM (Grails Object Relational Mapping) is not flexible enough for your liking you can alternatively map your domain class using Hibernate. To do this create a `hibernate.cfg.xml` file in the `grails-app/conf/hibernate` directory of your project and the corresponding HBM mapping xml files for your domain classes.

> For more info on how to do this read the documentation on mapping on the Hibernate Website

This will allow you to map Grails domain classes onto a wider range of legacy systems and be more flexible in the creation of your database schema.

Grails also allows you to write your domain model in Java or re-use an existing domain model that has been mapped using Hibernate. All you have to do is place the necessary `hibernate.cfg.xml` file and corresponding mappings files in the `grails-app/conf/hibernate` directory.

Additionally, the good news is you will still be able to call all of the dynamic persistent and query methods allowed in GORM!