Generated with Auto Strategy

The AUTO strategy will select a generator depending on your database. This is a good choice, if you need to support multiple databases.

If your database supports sequences, they will be used. By default Hibernate uses a sequence named hibernate_id_seq. Make sure that it exists if you create your database manually.

You must add the @GeneratedValue annotation to your primary key.

@Entity
public class Cheetah implements Serializable {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Integer id;

Same as XML mapping:

  <class name="Cheetah" table="cheetah">
    <id name="id" type="integer">
      <column name="id" />
      <generator class="native">
      </generator>
    </id>
..... snip .....