title: @TableGenerator : how to use
body: <p>i will try to generate the primary keys using table generator. but when i insert the 6 records in my table, the primaryKey table show only one on value. here is the following code</p>
  
  <p>My Entity class</p>
  
  <pre><code>package com.generatorvaluetest.domain;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.SequenceGenerator;
  import javax.persistence.TableGenerator;
  
  @Entity
  public class Snufu {
  private int autoId;
  private int identityId;
  private int sequenceId;
  private int tableId;
  private String name;
  public int getAutoId() {
      return autoId;
  }
  public void setAutoId(int autoId) {
      this.autoId = autoId;
  }
  public int getIdentityId() {
      return identityId;
  }
  public void setIdentityId(int identityId) {
      this.identityId = identityId;
  }
  public int getSequenceId() {
      return sequenceId;
  }
  public void setSequenceId(int sequenceId) {
      this.sequenceId = sequenceId;
  }
  
  @Id
  @TableGenerator(name="tg" , table="pk_table", pkColumnName="name" , 
  valueColumnName="vlaue" , allocationSize=10)
  @GeneratedValue(strategy=GenerationType.TABLE , generator="tg")
  public int getTableId() {
      return tableId;
  }
  public void setTableId(int tableId) {
      this.tableId = tableId;
  }
  
  public String getName() {
      return name;
  }
  public void setName(String name) {
      this.name = name;
  }
    }
  </code></pre>
  
  <p>This is my main class </p>
  
  <pre><code> package com.generatorvaluetest.main;
  
   import org.hibernate.HibernateException;
   import org.hibernate.Session;
  
   import com.generatorvaluetest.domain.Snufu;
   import com.generatorvaluetest.util.HibernateUtil;
  
   public class GeneratorValueTest {
  public static void main(String[] args) throws HibernateException{
      HibernateUtil.recreateDatabase();
      Session session = HibernateUtil.beginTransaction();
      for(int i = 0 ; i&lt; 5 ; i++){
          Snufu snufu = new Snufu();
          snufu.setName("jimmy"+i);
          session.saveOrUpdate(snufu);
      }
  
      new Thread(new Runnable() {
  
          @Override
          public void run() {
              Session session = HibernateUtil.beginTransaction();
              Snufu snufu = new Snufu();
              snufu.setName("jimmykalra");
              session.saveOrUpdate(snufu);
              HibernateUtil.commitTransaction();
          }
      }).start();
      HibernateUtil.commitTransaction();
  }
    }
  </code></pre>
  
  <p>in database when i select the values from pk_table the values are</p>
  
  <pre><code>|name | value|
  |snuf | 1    |
  </code></pre>
  
  <p>but in snufu tables there are 6 records </p>