title: org.hibernate.exception.ConstraintViolationException: could not update - Auto-increment column in DB is NULL
body: <p>I am upgrading my System's hibernate3 package from version "3.1.1" to "3.6.10".</p>
  
  <p>As I already migrated it to the 3.6.10 version, I am seeing an exception:</p>
  
  <pre><code>[6/12/17 9:54:57:365 SGT] 000000a2 SystemOut     O [DEBUG] [8adbbb8205c9a02b50015c09a02d15e00000|TKN_ENQ_REQ|10.91.48.113] 12/06/17 09:54 ib.CustomerVerification  - [Ex
  ception Caught Caused By:]
  &lt;b&gt;org.hibernate.exception.ConstraintViolationException: could not update: &lt;/b&gt;[com.dbs.tms.main.pojo.Customer#8adbbb825c9a02b5015c9a02da3e0001]
          at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2613)
          at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2495)
          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2822)
          at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:113)
          at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
          at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
          at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)
          at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
          at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
         ... 
         ....
         ...
         ..
  &lt;b&gt;Caused by: com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: Assignment of a NULL value to a NOT NULL column "TBSPACEID=5, TABLEID=9, COLNO=1" is not allowed
  .. SQLCODE=-407, SQLSTATE=23502, DRIVER=3.64.133 &lt;/b&gt;
          at com.ibm.db2.jcc.am.bd.a(bd.java:675)
          at com.ibm.db2.jcc.am.bd.a(bd.java:60)
          at com.ibm.db2.jcc.am.bd.a(bd.java:127)
  </code></pre>
  
  <p>It seems like the column (COL=1) in the CUSTOMERS table (TABLEID=9), when I update is NULL. the value is auto-generated by the Database (DB2) and should be set in the Customer Object. </p>
  
  <p>Column DB Properties: </p>
  
  <p><a href="https://i.stack.imgur.com/OgTuz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OgTuz.jpg" alt="enter image description here"></a></p>
  
  <p>Customer's HBM.xml (Highlighted is the column experiencing Null values (should not be Null):</p>
  
  <p><a href="https://i.stack.imgur.com/L4He3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L4He3.jpg" alt="enter image description here"></a></p>
  
  <p>Hope someone could help to resolve my concern.</p>