title: Hibernate Unknown integral data type for ids
body: <p>I'm starting with Hibernate and I have an error that I just can't figure out.</p>
  
  <p>I have the following Classes:</p>
  
  <pre><code>@Entity
  @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
  public abstract class AbstractColumn {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private String id;
      private String name;
  
  //Other stuff
  }
  </code></pre>
  
  <p>Then I have</p>
  
  <pre><code>@Entity
  public class DoubleColumn extends AbstractColumn  implements Column {
  
      @ElementCollection
      private Map&lt;Double,String&gt; isNA;
      private double min=0;
      private double max=0;
      @ElementCollection
      private List&lt;Double&gt; data;
      // a lot of stuff
  }
  </code></pre>
  
  <p>And finally:</p>
  
  <pre><code>@Entity
  public class DataFrame {
      @OneToMany(cascade = CascadeType.ALL)
      @PrimaryKeyJoinColumn
      private List&lt;AbstractColumn&gt; data;
      private String name;
      @Id
      @GeneratedValue
      private String id;
      @ElementCollection
      private Map&lt;String,Integer&gt; colIndex;
  //more stuff
  }
  </code></pre>
  
  <p>The error I'm getting is:</p>
  
  <pre><code>Exception in thread "main" org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String
      at org.hibernate.id.IdentifierGeneratorHelper.getIntegralDataTypeHolder(IdentifierGeneratorHelper.java:224)
      at org.hibernate.id.enhanced.SequenceStructure$1.getNextValue(SequenceStructure.java:98)
      at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40)
      at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:432)
      at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:105)
      at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)
      at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)
      at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177)
      at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)
      at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)
      at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:675)
      at org.hibernate.internal.SessionImpl.save(SessionImpl.java:667)
      at org.hibernate.internal.SessionImpl.save(SessionImpl.java:662)
      at Main.main(Main.java:285)
  </code></pre>
  
  <p>The only hint that the error throws is that the error is in the main class here:</p>
  
  <pre><code>DoubleColumn c1 = new DoubleColumn("Datos varios");
          c1.addData(12);
          c1.addData(11);
          c1.addData(131);
          c1.addData(121);
          c1.addData(151);
          c1.addData(116);
  
  
          DataFrame datosHibernate = new DataFrame("Dataframe Hibernate");
          datosHibernate.addColumn(c1);
  
  
          Configuration hibernateConfig = new Configuration();
          SessionFactory sessionFactory = hibernateConfig.configure().buildSessionFactory();
          Session session = sessionFactory.openSession();
          session.beginTransaction();
          session.save(datosHibernate);
          session.getTransaction().commit();
          session.disconnect();
          session.close();
          System.exit(0);
  </code></pre>
  
  <p>The ids are Strings, and I have them annotated as @GeneratedValue (I think I do not need to initialize them myself). The relation @OneToMany have the cascade annotation so it should be mapped correctly.</p>
  
  <p>I've tried the code WITHOUT the session.save line and doesn't throw errors, so is not a problem in the code per se, it has to be something with Hibernate.</p>
  
  <p>My configuration file is:</p>
  
  <pre><code>&lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="connection.url"&gt;jdbc:h2:E:/bd;DB_CLOSE_DELAY=-1;MVCC=TRUE&lt;/property&gt;
          &lt;property name="connection.driver_class"&gt;org.h2.Driver&lt;/property&gt;
          &lt;property name="connection.username"&gt;user&lt;/property&gt;
          &lt;property name="connection.password"&gt;&lt;/property&gt;
          &lt;property name="dialect"&gt;org.hibernate.dialect.H2Dialect&lt;/property&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;property name="hbm2ddl.auto"&gt;create&lt;/property&gt;
  
          &lt;mapping class="com.dataframe.estructuras.DataFrame"&gt;&lt;/mapping&gt;
          &lt;mapping class="com.dataframe.estructuras.column.AbstractColumn"/&gt;
          &lt;mapping class="com.dataframe.estructuras.column.types.DoubleColumn"/&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>It creates the database file and I see all the SQL code generated, tables and all. Is when it tries to store the info when the thing breaks.</p>