This link is about Java Persistence API and seems regularly updated.
http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing
Identity sequencing
Identity sequencing uses special IDENTITY columns in the database to
allow the database to automatically assign an id to the object when
its row is inserted. Identity columns are supported in many databases,
such as MySQL, DB2, SQL Server, Sybase, and PostgreSQL. Oracle does
not support IDENTITY columns but its is possible to simulate them
using sequence objects and triggers.
Sequence objects
Sequence objects use special database objects to generate ids.
Sequence objects are only supported in some databases, such as Oracle,
DB2, and Postgres. Usually, a SEQUENCE object has a name, an
INCREMENT, and other database object settings. Each time the
.NEXTVAL is selected the sequence is incremented by the
INCREMENT.
Edit
If the database such as DB2 supports both IDENTITY columns and Sequences hibernate chooses Identity columns, see Dialect:
public Class getNativeIdentifierGeneratorClass() {
if ( supportsIdentityColumns() ) {
return IdentityGenerator.class;
}
else if ( supportsSequences() ) {
return SequenceGenerator.class;
}
else {
return TableHiLoGenerator.class;
}
}
You can check what is returned from supportsIdentityColumns() and supportsSequences() for each database by looking at the relevant dialect in the org.hibernate.dialect
package.