title: org.hibernate.AnnotationException: Collection has neither generic type or OneToMany.targetEntity()
body: <p>I used <strong>Hibernate Tools</strong> to generate my Hibernate POJO mapping. </p>
  
  <p>Unfortunately the code generated by Hibernate tools seems not to work, I get the exception</p>
  
  <p><em>org.hibernate.AnnotationException: Collection has neither generic type or OneToMany.targetEntity()</em></p>
  
  <p>The code parts that generate the exception are</p>
  
  <pre><code>/**
   * ClassFlag generated by hbm2java
   */
  @Entity
  @Table(name = "class_flag", catalog = "incbszdb")
  public class ClassFlag implements java.io.Serializable {
  
      ....
      /* HERE */
      private Set classFlagI18ns = new HashSet(0);
  
      /* HERE */
      public void setClassFlagI18ns(Set classFlagI18ns) {
        this.classFlagI18ns = classFlagI18ns;
      }
  
  }  
  </code></pre>
  
  <p>According to this post </p>
  
  <p><a href="http://www.mkyong.com/hibernate/org-hibernate-annotationexception-collection-has-neither-generic-type-or-onetomany-targetentity/comment-page-1/#comment-67404" rel="noreferrer">http://www.mkyong.com/hibernate/org-hibernate-annotationexception-collection-has-neither-generic-type-or-onetomany-targetentity/comment-page-1/#comment-67404</a></p>
  
  <p>and this post </p>
  
  <p><a href="http://www.mkyong.com/hibernate/hibernate-error-collection-has-neither-generic-type-or-onetomany-targetentity/" rel="noreferrer">http://www.mkyong.com/hibernate/hibernate-error-collection-has-neither-generic-type-or-onetomany-targetentity/</a></p>
  
  <p>You have to change Hibernates generated code by yourself by hand. </p>
  
  <p>This is one thing I want to avoid. Any ideas what could be the problem?</p>
  
  <p>Regards</p>
  
  <p>JS</p>