title: Using multiple @GenericGenerator?
body: <p>I experimented with Hibernate's <code>@GenericGenerator</code> in a Spring Boot project (Hibernate 5). Made a test entity like this:</p>
  
  <pre><code>@Entity
  public class BatchTest implements Serializable {
      private static final long serialVersionUID = 3012542467060581674L;
  
      @Id
      @GeneratedValue(generator = "batchTestIdGenerator")
      @GenericGenerator(
              name = "batchTestIdGenerator",
              strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
              parameters = {
                      @org.hibernate.annotations.Parameter(name = "increment_size",value = "1000")
              }
      )
      private long id;
  
      @Lob
      @Column(nullable = false)
      private String someVal;
  ...
  </code></pre>
  
  <p>Using this generator I can insert entities really fast with JPA (I have a Spring Repository, served by a <code>@Service</code>) and it's cool, but how is the sequence actually stored? My database currently is an SQL Server 2016 instance, and in the schema, I can see that I have a <code>dbo.hibernate_sequence</code>:
  <a href="https://i.stack.imgur.com/JlLUi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JlLUi.jpg" alt="enter image description here"></a></p>
  
  <p>If I create a second entity, with a different generator, I get an exception during startup:</p>
  
  <pre><code>@Id
  @GeneratedValue(generator = "batchTestIdGenerator2", strategy = GenerationType.SEQUENCE)
  @GenericGenerator(
          name = "batchTestIdGenerator2",
          strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
          parameters = {
                  @org.hibernate.annotations.Parameter(name = "increment_size",value = "500")
          }
  )
  private long id;
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Multiple references to database sequence [hibernate_sequence] were encountered attempting toset conflicting values for 'increment size'.  Found [500] and [1000]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
  </code></pre>
  
  <p>Can I define different sequences at all? It seems like It tries to use the same <code>dbo.hibernate_sequence</code> for both sequences (id did not create a new dbo sequence in the database) and just disregards the name. If it is possible to define <code>N</code> number of sequence, how can I do it?</p>
  
  <p>Edit: I tried to create the sequences manually (matching names), but I still get the same error.</p>