Example usage for javax.persistence Query getResultList

List of usage examples for javax.persistence Query getResultList

Introduction

In this page you can find the example usage for javax.persistence Query getResultList.

Prototype

List getResultList();

Source Link

Document

Execute a SELECT query and return the query results as an untyped List.

Usage

From source file:vlove.dao.impl.GenericDaoImpl.java

/**
 * @see vlove.dao.GenericDao#namedQuery(String, Map, int, int)
 *///from w w  w  . j  a  va2 s.  c  o  m
@Override
public <T> List<T> namedQuery(String query, Map<String, Object> parameters, int firstResult, int maxResults) {
    Query q = em.createNamedQuery(query).setFirstResult(firstResult).setMaxResults(maxResults);
    applyParameters(q, parameters);
    return q.getResultList();
}

From source file:Address.java

  public Collection<Company> findAllCompanies() {
  Query query = em.createQuery("SELECT e FROM Company e");
  return (Collection<Company>) query.getResultList();
}

From source file:org.syncope.core.persistence.dao.impl.ResourceDAOImpl.java

@Override
public List<ExternalResource> findAll() {
    Query query = entityManager
            .createQuery("SELECT e " + "FROM  " + ExternalResource.class.getSimpleName() + " e");
    return query.getResultList();
}

From source file:Department.java

    public Collection<Professor> findAllProfessors() {
    Query query = em.createQuery("SELECT e FROM Professor e");
    return (Collection<Professor>) query.getResultList();
}

From source file:com.vizaco.onlinecontrol.dao.jpa.JpaStudentDaoImpl.java

public Collection<Student> findByLastName(String lastName) {
    Query query = this.em.createQuery(
            "SELECT DISTINCT student FROM Student student left join fetch student.users WHERE student.lastName LIKE :lastName");
    query.setParameter("lastName", lastName + "%");
    List resultList = query.getResultList();
    return query.getResultList();
}

From source file:org.kuali.mobility.maps.dao.LocationDaoImpl.java

public List<MapsGroup> getAllMapsGroups() {
    Query query = entityManager.createQuery("select group from MapsGroup group order by group.groupId");
    return query.getResultList();
}

From source file:com.tapas.evidence.repository.ResponsiblePersonRepositoryImpl.java

@Override
@SuppressWarnings("unchecked")
public List<ResponsiblePerson> findAll() {
    final Long tenantId = ((EvidenceUserDetails) SecurityContextHolder.getContext().getAuthentication()
            .getPrincipal()).getTenantId();
    Query query = this.entityManager.createNamedQuery(ResponsiblePerson.QUERY_NAME_FIND_ALL_BY_DELETED_FLAG);
    query.setParameter("deleted", Boolean.FALSE);
    query.setParameter("tenantId", tenantId);
    return query.getResultList();
}

From source file:Department.java

    public Collection<Department> findAllDepartments() {
    Query query = em.createQuery("SELECT d FROM Department d");
    return (Collection<Department>) query.getResultList();
}

From source file:org.syncope.core.persistence.dao.impl.RoleDAOImpl.java

@Override
public List<SyncopeRole> find(final String name) {
    Query query = entityManager.createQuery("SELECT e FROM SyncopeRole e WHERE e.name = :name");
    query.setParameter("name", name);

    return query.getResultList();
}

From source file:org.syncope.core.persistence.dao.impl.VirSchemaDAOImpl.java

@Override
public <T extends AbstractVirAttr> List<T> getAttributes(final AbstractVirSchema virtualSchema,
        final Class<T> reference) {

    Query query = entityManager.createQuery(
            "SELECT e FROM " + reference.getSimpleName() + " e" + " WHERE e.virtualSchema=:schema");
    query.setParameter("schema", virtualSchema);

    return query.getResultList();
}