title: GenerationType.SEQUENCE does not generate sequence in hibernate
body: <p>This is my entity file :-  </p>
  
  <pre><code>@Entity
  @Table(name = "tbl_article_function_instruction_status")
  @XmlRootElement
  
  public class ArticleFonctionInstructionStatuts extends BaseEntity implements Serializable
  {
      private static final long                                   serialVersionUID    = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AFIS_Sequence")
      @SequenceGenerator(allocationSize = 5000, name="AFIS_Sequence", sequenceName="AFIS_Sequence")
      @Basic(optional = false)
      @Column(name = "art_fun_ins_status_id")
      private Integer                                             afiStaIndex;
  
      @Basic(optional = false)
      @Column(name = "art_fun_ins_status_date")
      @Temporal(TemporalType.TIMESTAMP)
      private Date                                                afiStaDate;
  
  }
  </code></pre>
  
  <p>I have tried <code>GenerationType.SEQUENCE</code> &amp; <code>GenerationType.AUTO</code>.<br>
  But in case of <code>GenerationType.SEQUENCE</code>, it gives me an error :-  </p>
  
  <blockquote>
    <p>Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1239)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:120)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:855)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845)
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844)
        at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564)
        ... 42 more
    Caused by: org.hibernate.MappingException: Could not instantiate id generator [entity-name=com.alstom.autofie.entity.ArticleFonctionInstructionStatuts]
        at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:123)
        at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:213)
        at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:323)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852)
        ... 50 more
    Caused by: org.hibernate.MappingException: com.alstom.autofie2.dao.CustomSQLDialect does not support sequences
        at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:882)
        at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:110)
        at org.hibernate.id.SequenceHiLoGenerator.configure(SequenceHiLoGenerator.java:55)
        at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:117)
        ... 54 more</p>
  </blockquote>
  
  <p>Here CustomSQLDialect is a class which extends SQLServerDialect.</p>
  
  <p>In case of <code>GenerationType.AUTO</code>, it gives me an error while inserting multiple records because it generates same key all the time, not sequential key. </p>
  
  <blockquote>
    <p>DEBUG IdentifierGeneratorHelper - Natively generated identity: 0</p>
  </blockquote>
  
  <p>I have verified in sql server, AFIS_Sequence is generating sequence each and every time. That means there is some issues with hibernate configuration.</p>
  
  <p>Is there any configuration missed or is it a bug of hibernate ?</p>