title: Hibernate associations with an interface
body: <p>I'm hoping someone can help me figure out a problem I am having with hibernate.</p>
  
  <p>I am working on a billing system where different types of entities can be invoiced. The entities implement an "Invoicable" interface.</p>
  
  <p>In my invoice class I have this line</p>
  
  <pre><code>@ManyToOne(fetch = FetchType.EAGER)
  private Invoiceable responsibleEntity;
  </code></pre>
  
  <p>The invoiceable interface looks like this</p>
  
  <pre><code>@MappedSuperclass
  public interface Invoiceable
  {
  // Name to display as entity responsible
  String getInvoiceOwnerName();
  
  // Get email address to send invoice
  String getInvoiceOwnerEmail();
  }
  </code></pre>
  
  <p>I'm getting an exception when I run this</p>
  
  <blockquote>
    <p>org.hibernate.AnnotationException: @OneToOne or @ManyToOne on models.Invoice.responsibleEntity references an unknown entity: interfaces.Invoiceable</p>
  </blockquote>
  
  <p>I've tried googling it and reading some similar posts but I can't get anything to work. Does hibernate support this type of mapping?</p>
  
  <p>Thanks</p>