java : return inherited child class type
<p>I'm trying to build a CRUD system using Hibernate. 
I want to build an interface for all my DB objects :</p>

<pre><code>public abstract class ADBElem { }
</code></pre>

<p>here is an example of a DB object method (read) :</p>

<pre><code>public static PrdProduct read(Integer id) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    PrdProduct product = null;
    product = (PrdProduct) session.get(PrdProduct.class, id);
    session.close();
    return product;
}
</code></pre>

<p>The return type depends of the inherited class, how do i put this method in my abstract class ?</p>

<p>What i found so far :</p>

<pre><code>public abstract class ADBElem&lt;T&gt; {
    public static T read(Integer id) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    T item = null;
    item = (T) session.get(T.class, id);
    session.close();
    return item;
 }

public class PrdProduct extends ADBElem&lt;PrdProduct&gt; {} 
</code></pre>

<p>but its not working, i got this error : cannot make static reference to non static type t</p>
