- All Implemented Interfaces and Traits:
- org.hibernate.id.IdentifierGenerator, org.hibernate.id.Configurable
@Slf4j
@CompileStatic
class SpringBeanIdGenerator
extends Object
A hibernate IdentifierGenerator that uses a Spring Bean ("idGenerator" is default) to get the id's.
beanName defaults to 'idGenerator' and keyName will be "${TableName}.${id_column}".
example config.groovy will set the defaults for all domains:
gorm.default.mapping = {
id generator:'gorm.tools.hibernate.SpringBeanIdGenerator'
}
can also be sdt in the domain mapping. Example with custom bean name and key name.
static mapping = {
id generator:'gorm.tools.hibernate.SpringBeanIdGenerator',
params:[beanName:'specialIdGen', keyName:'Org.uuid']
}
- Authors:
- Joshua Burnett
- Since:
- 1.0