For testing I'm using the **H2 database**.

For production it's **MySQL**.

I understrand that both support `AUTO_INCREMENT` ([mysql](http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html) / [h2](http://www.h2database.com/html/grammar.html#column_definition)), but it seems like Hibernate doesn't work this way.

`identity` is supported for MySQL. Fine.  

What about H2? Should I write my own generator or...? (using the `org.hibernate.id.IdentifierGenerator` interface as the doc [says](http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#d5e2502)).

I must have a nice clean & quick way to get an ID (of type `long` by the way) from the database itself because **the application is in a cluster** (i.e several servers `INSERT` into the database at once)... that's why `increment` is definitely not for me.

Thanks!