## 5.5.2.4 Custom Database Identity

You can customize how GORM generates identifiers for the database using the DSL. By default GORM relies on the native database mechanism for generating ids. This is by far the best approach, but there are still many schemas that have different approaches to identity.

To deal with this Hibernate defines the concept of an id generator. You can customize the id generator and the column it maps to as follows:

    class Person {
      ..
      static mapping = {
          table 'people'
          version false
          id generator:'hilo', params:[table:'hi_value',column:'next_value',max_lo:100]
      }
    }

In this case we're using one of Hibernate's built in 'hilo' generators that uses a separate table to generate ids.

> For more information on the different Hibernate generators refer to the Hibernate reference documentation

Note that if you want to merely customise the column that the id lives on you can do:

    class Person {
      ..
      static mapping = {
          table 'people'
          version false
          id column:'person_id'
      }
    }