title: JPA and generics
body: <p>I'm wondering how an abstract class with generics would handle with JPA? I mean what kind of annotations do I need for the field?</p>
  
  <p>Consider these:</p>
  
  <pre><code>@MappedSuperclass
  public abstract class AbstractMyClass&lt;T&gt; {
    // What about Strings and Integers? Do I need some kind of @LOB?
    private T field;
  
    public T getField() {
      return field;
    }
  
    public void setField(T field) {
      this.field = field;
    }
  }
  </code></pre>
  
  <p>And then these</p>
  
  <pre><code>@Entity
  @Table(name = "String")
  public class MyStringClass extends AbstractMyClass&lt;String&gt; {
  }
  
  @Entity
  @Table(name = "Integer")
  public class MyIntegerClass extends AbstractMyClass&lt;Integer&gt; {
  }
  </code></pre>