title: hibernate generator native class does not increment my user_id column
body: <p>i am using the following hibernate mapping file
  </p>
  
  <pre><code>&lt;class name="com.abdus.hibernate.UserTable" table="tbl_users"&gt;
      &lt;meta attribute="class-description"&gt;
          This class contains the user details.
      &lt;/meta&gt;
      &lt;id name="userId" type="long" column="userId"&gt;
          &lt;generator class="native" /&gt;
      &lt;/id&gt;
      &lt;property name="firstName" type="string" column="firstName" not-null="true" /&gt;
      &lt;property name="lastName" type="string" column="lastName" not-null="true" /&gt;
      &lt;property name="emailId" type="string" column="emailId" not-null="true" /&gt;
      &lt;property name="password" type="string" column="password" not-null="true" /&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p></p>
  
  <p>And here is my code to insert a new record</p>
  
  <pre><code>public Long add(UserDomain userDomain) {
      Session session = HibernateUtil.getSessionFactory().openSession();
      Transaction transaction = null;
      Long userId = null;
      try {
          transaction = session.beginTransaction();
          UserTable userTable = new UserTable();
          userTable.setFirstName(userDomain.getFirstName());
          userTable.setLastName(userDomain.getLastName());
          userTable.setEmailId(userDomain.getEmailId());
          userTable.setPassword(userDomain.getPassword());
          userId = (Long) session.save(userTable);
          System.out.println("userId returned is " + userId);
          transaction.commit();
          userTable.toString();
      } catch (Exception e) {
          transaction.rollback();
          e.printStackTrace();
      } finally {
          session.close();
      }
      return userId;
  }
  </code></pre>
  
  <p>But what i see is every time i insert a record, it always gets inserted a user_id as 1. Meaning there is always only one record in the DB with user_id 1. Why does hibernate not increment the value of user_id every time i insert a record?</p>