title: saveorupdate in Hibernate not working using @generated value in hibernate
body: <p>I have a problem with saveOrUpdate() function in hibernate.
  I am using Oracle database. I need to insert a row with an auto generated primary key. I have configured this id in hibernate annotations as follows,</p>
  
  <p><strong>Model.java</strong></p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column (name = "blush_id")
  private Integer blsId; 
  </code></pre>
  
  <p>But while executing the insert query, the id alone is getting generated. The saveOrUpdate method is not executed.</p>
  
  <p><strong>DAO.java</strong></p>
  
  <pre><code>private SessionFactory sessionFactory;
  public void setSessionFactory(SessionFactory sessionFactory){
      this.sessionFactory = sessionFactory;
  } 
  public void executeSaveOrUpdate(Object obj){            
      sessionFactory.getCurrentSession().saveOrUpdate(obj);//id generation occurs but the saveOrUpdate(obj) method is not executed
  }
  </code></pre>
  
  <p>There is no error or exception thrown, but the insert query not executing (instead sequence is generated as in the 2nd line of console), control going to its next process. </p>
  
  <h2>Console:</h2>
  
  <pre><code>16:41:55,928 INFO  [STDOUT] Hibernate: select category0_.cat_nbr as cat1_2_, category0_.added_by_name as added2_2_, category0_.added_ts as added3_2_, category0_.cat_dsc as cat4_2_, category0_.last_updt_by_name as last5_2_, category0_.last_updt_ts as last6_2_, category0_.mdse_grp_dsc as mdse7_2_, category0_.mdse_grp_nbr as mdse8_2_ from cvs_category_admin category0_ order by category0_.cat_nbr
  16:41:56,037 INFO  [STDOUT] Hibernate: select hibernate_sequence.nextval from dual
  16:41:56,084 INFO  [STDOUT] Hibernate: select blushrules0_.blush_id as blush1_1_, blushrules0_.added_by_name as added2_1_, blushrules0_.added_ts as added3_1_, blushrules0_.blush_item_type as blush4_1_, blushrules0_.cat_nbr as cat5_1_, blushrules0_.subcat_nbr as subcat12_1_, blushrules0_.is_active as is6_1_, blushrules0_.is_added as is7_1_, blushrules0_.last_updt_by_name as last8_1_, blushrules0_.last_updt_ts as last9_1_, blushrules0_.sku_nbr as sku10_1_, blushrules0_.status as status1_ from blush_admin_rules blushrules0_ where blushrules0_.status='A'
  </code></pre>
  
  <p>Please help me on this issue.. </p>