# 15. Grails and Hibernate

If GORM (Grails Object Relational Mapping) is not flexible enough for your liking you can alternatively write some or all of your domain classes in Java or re-use an existing domain model that has been mapped using Hibernate. To do this create a `hibernate.cfg.xml` file in the `grails-app/conf/hibernate` directory of your project and add the corresponding HBM mapping xml files for your domain classes. You can do this manually or by running the create-hibernate-cfg-xml script.

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

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

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