title: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class
body: <p>I am trying to use onetomany mapping for product specifications where I copied similar working code from descriptions. I am providing all my code.</p>
  
  <pre><code>Caused by: javax.persistence.PersistenceException: [PersistenceUnit: sm-unit] Unable to build EntityManagerFactory
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
          at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:257)
          at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
          ... 38 more
  Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.salesmanager.core.business.catalog.product.model.Product.specifications[com.salesmanager.core.business.catalog.product.model.specification.ProductSpecification]
          at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1204)
  </code></pre>
  
  <p>Product.java has entry like this:</p>
  
  <pre><code>@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, mappedBy = "product")
      private Set&lt;ProductSpecification&gt; specifications = new HashSet&lt;ProductSpecification&gt;();
  </code></pre>
  
  <p>ProductSpecification.java has below code..</p>
  
  <pre><code>@Entity
  @Table(name = "PRODUCT_SPECIFICATION", schema=SchemaConstant.BEAWLP_JAMBIRA_SCHEMA)
  public class ProductSpecification extends SalesManagerEntity&lt;Long, ProductSpecification&gt; {
      private static final long serialVersionUID = -7991123525661321865L;
  
      @ManyToOne(targetEntity = Product.class)
      @JoinColumn(name = "PRODUCT_ID", nullable = false)
      private Product product;
  
  @Id
  @Column(name = "SPECIFICATION_ID", unique = true, nullable = false)
  @TableGenerator(name = "TABLE_GEN", table = "SM_SEQUENCER", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "SPECIFICATION_SEQ_NEXT_VAL")
  @GeneratedValue(strategy = GenerationType.TABLE, generator = "TABLE_GEN")
  private Long id;
  
  @Column(name="TITLE", length=100)
  private String title;
  
  public ProductSpecification() {
  }
  
  public Product getProduct() {
      return product;
  }
  
  public void setProduct(Product product) {
      this.product = product;
  }
  
  public String getTitle() {
      return title;
  }
  
  public void setTitle(String title) {
      this.title = title;
  }
  
  public Long getId() {
      return id;
  }
  
  public void setId(Long id) {
      this.id = id;
  }
  </code></pre>