原文地址 :http://docs.jboss.org/hibernate/core/4.0/manual/en-US/html/mapping.html#mapping-declaration-id
----------------------------
Identifier generator
-----------------------------
-
Out of the box, comes with the following strategies:
-
org.hibernate.id.uuid.CustomVersionOneStrategy
- generates "version 1" UUID values, using IP address since mac address not available. If you need mac address to be used, consider leveraging one of the existing third party UUID generators which sniff out mac address and integrating it via theorg.hibernate.id.UUIDGenerationStrategy
contract. Two such libraries known at time of this writing include http://johannburkard.de/software/uuid/ andhttp://commons.apache.org/sandbox/id/uuid.html
-
uses a database-generated GUID string on MS SQL Server and MySQL.
-
selects
identity
,sequence
orhilo
depending upon the capabilities of the underlying database. -
lets the application assign an identifier to the object before
save()
is called. This is the default strategy if no<generator>
element is specified. -
retrieves a primary key, assigned by a database trigger, by selecting the row by some unique key and retrieving the primary key value.
-
uses the identifier of another associated object. It is usually used in conjunction with a
<one-to-one>
primary key association. -
a specialized sequence generation strategy that utilizes a database sequence for the actual value generation, but combines this with JDBC3 getGeneratedKeys to return the generated identifier value as part of the insert statement execution. This strategy is only supported on Oracle 10g drivers targeted for JDK 1.4. Comments on these insert statements are disabled due to a bug in the Oracle drivers.
increment
identity
sequence
hilo
seqhilo
uuid
uuid2
guid
native
assigned
select
foreign
sequence-identity