title: Spring Data jpa (hibernate) nullpointer Exception when adding List of Entities
body: <p>first my Code.</p>
  
  <p><strong>Specialization</strong></p>
  
  <pre><code>@Entity
  public class Specialization {
  
      @Id
      private String name;
  
      @OneToMany(cascade = CascadeType.ALL)
      @JoinColumn(name="att_id", referencedColumnName="ID")
      private List&lt;Attribute&gt; attributes;
  
      //Getters and Setters
  }
  </code></pre>
  
  <p><strong>Attribute</strong></p>
  
  <pre><code>@Entity
  public class Attribute {
  
      @Id
      @GeneratedValue(strategy= GenerationType.AUTO)
      private Long id;
  
      private String name;
      private double scaling;
  
      //Getters and Setters
  }
  </code></pre>
  
  <p>My Problem is that i get a following Exception:</p>
  
  <pre><code>Caused by: java.lang.NullPointerException
      at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1460)
      at org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass(CollectionBinder.java:864)
      at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:779)
      at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:728)
      at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:70)
      at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1697)
      at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1426)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852)
      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:1625)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562)
      ... 98 more
  </code></pre>
  
  <p>This Exception only Occurs after adding the attribute <code>attributes</code> to the Class <code>Specialization</code>.  So without this attribute everything works fine, but if I add this attribute, the exception comes up. I don't get what I'm doing wrong.
  Maybe somebody could find my mistake?</p>
  
  <p><strong>Additional information:</strong></p>
  
  <p>Hibernate Core Version: 4.3.7. Final.</p>
  
  <p>There is another Entity <code>GameClass</code> with a oneToMany relationship to Specialization => Every <code>GameClass</code> has multiple <code>Specialization</code>s and every <code>Specialization</code> has multiple <code>Attribute</code>s.</p>
  
  <p>Don't know if this matters but this is a Spring-Boot application</p>