Start New Discussion within our Software Development Community

Hello i have an problem with an inheritance query using JPA
(There is my Class Hierarchy)
+UsuarioGenerico (MappedSuperclass or Entity - but is Abstract)
-+Usuario (Entity)
-+UsuarioPorEmpresa (Entity)

Then, when i try make an select for Usuario, i not obtain results
i try with an NamedQuery:
@NamedQuery(name="Usuario.findAll", query="SELECT u FROM Usuario u")
i try with this, but not obtain results
@NamedQuery(name="Usuario.findAll", query="SELECT u FROM UsuarioGenerico u where TYPE(u) = Usuario")

public  class Usuario extends UsuarioGenerico implements Serializable {

    public static final String FIND_ALL = "Usuario.findAll";
}

then i use this in an DAO class, but not have results

public List<Usuario> findAll() {
    return super.findList(Usuario.FIND_ALL);
}

//
i try too with an generic, using CriteriaBuilder, but not have results (claseEntity = Usuario)

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public List<T> findAll() {
    CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
    cq.select(cq.from(claseEntity));
    return em.createQuery(cq).getResultList();
}

how i can obtain results for list all Usuarios? --- please help me

This question has already been answered. Start a new discussion instead.