title: db2 identity with hibernate configuration (SQL Error: -142, SQLState: 42612)
body: <p>Please help on DB2 identity in Hibernate annotation.</p>
  
  <p>Im using DB2 version 10.01, trying to insert values into the table using hibernate save() method.</p>
  
  <p>Id annotation:</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Basic(optional = false)
  @Column(name = "stmciss_id",unique=true,nullable=false)
  protected int id;
  </code></pre>
  
  <p>Hibernate configuration:</p>
  
  <pre><code>&lt;property name="hibernate.connection.driver_class"&gt;com.ibm.db2.jcc.DB2Driver&lt;/property&gt;
  </code></pre>
  
  <p>Identity creation in the schema:</p>
  
  <pre><code>"STMCISS_ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (
  
              START WITH 5000000
  
              INCREMENT BY 1
  
              MINVALUE 1208950
  
              MAXVALUE 2147483647
  
              NO CYCLE
  
              NO CACHE
  
              NO ORDER ),
  
          "SER_NO" CHAR(6) FOR SBCS DATA NOT NULL,
          "TS" TIMESTAMP WITH DEFAULT NULL,
          "TS_DEF" TIMESTAMP NOT NULL WITH DEFAULT ,
  
  
      )
  </code></pre>
  
  <p>Getting the error as mentioned below:</p>
  
  <pre><code>Hibernate: insert into schema.table_name (id, cmplt_by_txt, cmplt_by_date, ts_last_updt, ts_load, ent_by_id) values (default, ?, ?, ?, ?, ?)
  
  Hibernate: values identity_val_local()
  May 12, 2015 3:21:07 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  WARN: SQL Error: -142, SQLState: 42612
  May 12, 2015 3:21:07 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  ERROR: DB2 SQL Error: SQLCODE=-142, SQLSTATE=42612, SQLERRMC=null, DRIVER=4.15.113
  May 12, 2015 3:21:07 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  WARN: SQL Error: -516, SQLState: 26501
  May 12, 2015 3:21:07 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  ERROR: DB2 SQL Error: SQLCODE=-516, SQLSTATE=26501, SQLERRMC=null, DRIVER=4.15.113
  May 12, 2015 3:21:07 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  WARN: SQL Error: -514, SQLState: 26501
  May 12, 2015 3:21:07 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  ERROR: DB2 SQL Error: SQLCODE=-514, SQLSTATE=26501, SQLERRMC=SQL_CURLH200C1, DRIVER=4.15.113
  org.hibernate.exception.SQLGrammarException: could not extract ResultSet
  </code></pre>