As per the Hibernate Developer guide 3.3 here, Hibernate provides support in many ways for generating Identifiers. But this is by using XML based mapping. [1] How to do the same by using Annotations?
Especially I'm interested in 'increment' type. The closest thing that i found is using @GeneratedValue(strategy=GenerationType.AUTO)
. But this is a JPA based strategy.
How can I use Hibernate based using Annotations?
And Even this information is not present in the Hibernate Developer Guide of version 4.3! Any particular reason for this?
UPDATE
I'm very well aware of the four strategies which is from JPA. I'm interested in the other types which Hibernate provides. Like hilo
, increment
, and so on. In documentation this is done by using XML configurations.Is there any way to use it with Annotations?
Hibernate implements JPA and uses the JPA id generation strategy.
Check the documentation here for 4.3 : http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/ : Section5.1.2.2. Identifier generator
Hibernate also provides @GenericGenerator which can be used to configure Hibernate specific generator by passing in strategy attribute