Hibernate: Generator Class

The <generator> sub-element of <id> specifies how to generate the unique identifier for the persistent objects. Hibernate defines many generator classes which implement org.hibernate. id.IdentifierGenerator interface. It is also possible to write a generator class implementing this interface. The type of generator is indicated in the <generator> element using class attribute as follows:

<generator class=”generator type”></generator>

Some of the built-in generator classes with their functions are discussed in Table 23.2:

Source: Uttam Kumar Roy (2015), Advanced Java programming, Oxford University Press.

Leave a Reply

Your email address will not be published. Required fields are marked *