Other XML Id tags

<id>

name="propertyName"
Name of the class property. This should correspond to a field. name="id" when the class contains private Integer id; public Integer getId() { return id;} public void setId(Integer id) { this.id = id;}
type="typename"
A Java type like java.lang.Integer or a Hibernate type. I recommend using Hibernate types as they allow to distinguish between date, time and timestamp. Java.lang.Date cannot do this!
column="column_name"
Name of the database column. Default is taken from name attribute. But you could define one if you like.
unsaved-value="null|any|none|undefined|id_value"
Specify the value used when the object is not yet saved. This attribute is rarely needed in Hibernate 3.
access="field|property|ClassName"
Default strategy used for accessing properties. Standard is property and you should keep this normally. This will use getters and setters to access fields. Field will access a property directly by its name. So your variables must be public. You can invent further methods with your own implementation of the interface org.hibernate.property.PropertyAccessor
node="element-name|@attribute-name|element/@attribute|."
Only needed for XML mapping. Read more about this in the Hibernate Reference in chapter XML Mapping.
Defines the primary key generator. You can find more details below.

Primary key generators

The generators can be subdivided into two groups. The first depends on database specific features and can only be used with the correct database. The second group is database independent. I recommend sequence or identity if supported by your database. When you need unique ids across databases you can uses uuid or guid if supported by your database. An alternative is to use composite ids. The first column is an identifier for the database. The second can be any kind of generator.

Database independent

hilo
gets the next high value from a configured database table and generates a low value.
assigned
Lets the application specify the primary key. Useful for natural unique keys.
foreign
Primary key is taken from a one-to-one related class
uuid
128-bit UUID algorithm to generate identifiers of type string, unique within a network (the IP address is used). The UUID is encoded as a string of hexadecimal digits of length 32.
increment
Do not use it. Generates only unique keys when no other thread is writing data at the same moment.
org.hibernate.id.MultipleHiLoPerTableGenerator
Supports multiple hilo generators in a single table, defined in the EJB3 spec

Database dependent

identity
Uses identity columns which are supported at least by DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The type depends on the database and the column. It can be long, short or integer.
sequence
uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. The returned identifier is of type long, short or int.
seqhilo
The advance of seqhilo over sequence is that Hibernate can generate more than one id from one database request. It uses a hi/lo algorithm to generate identifiers of the types long, short or int. You must specify a database sequence for the high part.
guid
It uses a database-generated GUID string on MS SQL Server and MySQL. This is unique across databases.
native
Selects a generator depending on the database capabilities. Chooses between identity, sequence or hilo.
select
Retrieves a primary key assigned by a database trigger.

Composite Id

<class name="BoxTurtle" table="boxturtle">
  <composite-id class="BoxTurtleId" name="id">
    <key-property name="favouriteSalad"></key-property>
    <key-property name="location"></key-property>
</composite-id>