title: H2 database: NULL not allowed for column "ID" when inserting record using jdbcTemplate
body: <p>I use hibernate's hbm2ddl to generate schema automatically. Here is my domain:</p>
  
  <pre><code>@Entity
  public class Reader {
  
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    Long id;
  
    @Column(nullable=false,unique=true)
    String name;
  
    @Enumerated(EnumType.STRING)
    Gender gender;
  
    int age;
  
    Date registeredDate = new Date();
  
  // getter and setter ...
  }
  </code></pre>
  
  <p>When I using hibernate to save a <code>reader</code>, it works fine as expected as it generats a id to the <code>reader</code> . However when I use jdbcTemplate to insert a record with pure SQL, it report an error:</p>
  
  <pre><code>org.springframework.dao.DataIntegrityViolationException: StatementCallback; 
  SQL [insert into reader(name,gender,age) values('Lily','FEMALE',21)]; 
  NULL not allowed for column "ID"; 
      SQL statement:insert into reader(name,gender,age) values('Lily','FEMALE',21) [23502-192]; 
  nested exception is org.h2.jdbc.JdbcSQLException: NULL not allowed for column "ID"; 
      SQL statement:  insert into reader(name,gender,age) values('Lily','FEMALE',21) [23502-192]
  </code></pre>
  
  <p>How to solve this?</p>
  
  <ol>
  <li>I debug to find that the DDL of hb2ddl generated is <code>create table Book (id bigint not null, author varchar(255), name varchar(255), price double not null, type varchar(255), primary key (id))</code>. It seems that the hiberate handle the id stratege in its own way but how?</li>
  <li>The <code>@GeneratedValue(strategy=GenerationType.AUTO)</code> should generate <code>auto increment</code> in the statement of the DDL but I didn't find that. Did I miss it?</li>
  </ol>