title: How to handle JPA annotations for a pointer to a generic interface
body: <p>I have a generic class that is also a mapped super class that has a private field that holds a pointer to another object of the same type:</p>
  
  <pre><code>@MappedSuperclass
  public abstract class MyClass&lt;T extends MyIfc&lt;T&gt;&gt;
      implements MyIfc&lt;T&gt;
      {
  
          @OneToOne()
          @JoinColumn(name = "previous", nullable = true)
          private T previous;
  
               ...
               }
  </code></pre>
  
  <p>My problem is that Eclipse is showing an error in the file at the OneToOne "Target Entity "T" for previous is not an Entity."  All of the implementations of MyIfc are, in fact, Entities.  I should also add that each concrete implementation that inherit from MyClass uses a different value for T (because T is itself) so I can't use the "targetEntity" attribute.</p>
  
  <p>I guess if there is no answer then I'll have to move this JPA annotation to all the concrete subclasses of MyClass.  It just <em>seems</em> like JPA/Hibernate should be smart enough to know it'll all work out at run-time.  Makes me wonder if I should just ignore this error somehow.</p>