title: CDI bean extends from a generic class
body: <p>I want a DAO that extends from a generic DAO like this:</p>
  
  <pre><code>public abstract class DAO&lt;T&gt; implements Serializable{
  
  private Class&lt;T&gt; entityClass;
  
  public DAO(){
  
  }
  
  public void setClass(Class&lt;T&gt; entityClass){
      this.entityClass=entityClass;
  } 
  
  protected abstract EntityManager getEntityManager();
  </code></pre>
  
  <p>and the CDI bean that extends from the generic class and is injected in an EJB</p>
  
  <pre><code>@Named("daoImpl")
  @RequestScoped
  public class DAOImpl extends DAO implements Serializable{
  
  
  @PersistenceContext(unitName = "pruebaEJBPU")
  private EntityManager em;
  
  @Override
  protected EntityManager getEntityManager() {
      return em;
  }
  
  
  public DAOImpl() {
  
      setClass(User.class);
  }
  </code></pre>
  
  <p>I have to use the setClass method because I want to inject this bean in an EJB and it can´t have an arg-constructor.</p>
  
  <p>This way works but it throws a warning that i can't avoid: WARNING:   The following warnings have been detected: WARNING: Parameter 1 of type java.lang.Class from public void p1.dao.setClase(java.lang.Class) is not resolvable to a concrete type.</p>
  
  <p>Is there another way to extend a CDI bean from a generic class or avoid the warnings? If i use an EJB like Netbeans does, all is fine but i don't want to use an EJB for a DAO. If i don't use a CDI bean, how can i inject a simple DAO in an EJB?</p>