title: ID auto generation for MySQL on JBoss AS 7
body: <p>I need help to resolve such problem. Application needs to support several DB (MySQL, Oracle). After migration to JBoss 7 entity id auto generation was broken.
  Etity example:</p>
  
  <pre><code>@Entity
  @Table(name="foo")
  public class Foo {
      private Integer id;
      private String model;
  
      @Id 
      @SequenceGenerator(name="foo_seq_gen", sequenceName="foo_0", initialValue=1, allocationSize=1)
      @Column(name="id", updatable=false)
      @GeneratedValue(generator = "foo_seq_gen")
      public Integer getId() {
          return id;
      }
      public void setId(Integer id) {
          this.id = id;
      }
  
      @Column(name="model", length=64, updatable=false)
      public String getModel() {
          return model;
      }
      public void setModel(String model) {
          this.model = model;
      }
  }
  </code></pre>
  
  <p>For Oracle it works fine. But when trying to perform create operation on MySQL following error occures:</p>
  
  <pre><code>15:34:56,290 ERROR [org.hibernate.util.JDBCExceptionReporter] (http-localhost-127.0.0.1-8080-1) Table 'scheme.foo_0' doesn't exist
  </code></pre>
  
  <p>Thus MySQL tries to access non-existent table as sequence instead of using native autogeneration mechanism.</p>
  
  <p>Does anybody know the cure?</p>
  
  <p>Using "table" generator strategy didn't help.</p>
  
  <p>Environment:</p>
  
  <pre><code>MySQL 5.5.16;
  JBoss AS 7.1.0.Beta1;
  Hibernate 3.6.1.
  </code></pre>
  
  <p>Thanks.</p>