Tag Archives: Hibernate

How to generate customize auto generated ids in grails?

You can customize random ids generated by GORM.

For this Hibernate has provided 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]

Here , ‘hilo’ is  Hibernate’s built in generator that uses a separate table to generate ids.

ProsperaSoft offers Grails development solutions. You can email at info@prosperasoft.com to get in touch with ProsperaSoft Grails experts and consultants.