Example usage for javax.persistence TypedQuery getResultList

List of usage examples for javax.persistence TypedQuery getResultList

Introduction

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

Prototype

List<X> getResultList();

Source Link

Document

Execute a SELECT query and return the query results as a typed List.

Usage

From source file:com.jcertif.abj2014.intro.spring.data.before.SpeakerServiceImpl.java

@Override
public List<Speaker> findAll(int page, int pageSize) {
    TypedQuery<Speaker> query = em.createQuery("select s from Speaker s", Speaker.class);

    query.setFirstResult(page * pageSize);
    query.setMaxResults(pageSize);/*from   w w w  . j  a  v  a 2  s  . c  om*/

    return query.getResultList();
}

From source file:eu.europa.ec.fisheries.uvms.rules.dao.ValidationMessageDao.java

public List<ValidationMessage> getValidationMessagesById(List<String> ids) throws ServiceException {
    TypedQuery query = this.getEntityManager().createNamedQuery(ValidationMessage.BY_ID,
            ValidationMessage.class);
    query.setParameter("messageIds", ids);
    return query.getResultList();
}

From source file:com.siriusit.spezg.multilib.storage.jpa.JpaUnitRepository.java

@Override
public List<? extends Unit> searchForAvailableUnits() {
    TypedQuery<UnitDomainObject> query = entityManager.createNamedQuery("findAllAvailableUnits",
            UnitDomainObject.class);
    return query.getResultList();
}

From source file:fi.vm.kapa.identification.metadata.dao.MetadataDAO.java

public List<Metadata> getMetadataByType(ProviderType providerType) {
    TypedQuery<Metadata> query = entityManager.createNamedQuery("Metadata.searchByProviderType", Metadata.class)
            .setParameter("providerType", providerType.toString());

    return query.getResultList();
}

From source file:br.eti.danielcamargo.backend.common.core.business.UsuarioService.java

public Usuario get(String email) {
    TypedQuery<Usuario> query = em.createNamedQuery(Usuario.GET_USUARIO_BY_EMAIL, Usuario.class);
    query.setParameter("email", email);

    List<Usuario> result = query.getResultList();
    return result.isEmpty() ? null : result.get(0);
}

From source file:com.ewcms.content.particular.dao.FrontProjectArticleDAO.java

public List<ProjectArticle> findProjectArticleLimit(Integer number) {
    String hql = "From ProjectArticle As p where p.release=true Order By p.published desc limit " + number;
    TypedQuery<ProjectArticle> query = this.getEntityManager().createQuery(hql, ProjectArticle.class);
    return query.getResultList();
}

From source file:com.smhdemo.common.report.dao.ParameterDao.java

public Boolean findSessionIsEntityByParameterIdAndUserName(final Long parameterId, final String userName) {
    String hql = "Select p From Parameter As p Where p.id=:parameterId And p.defaultValue=:userName";

    TypedQuery<Parameter> query = this.getEntityManager().createQuery(hql, Parameter.class);
    query.setParameter("parameterId", parameterId);
    query.setParameter("userName", userName);

    List<Parameter> list = query.getResultList();
    return list.isEmpty() ? false : true;
}

From source file:org.jasig.portlet.blackboardvcportlet.dao.impl.MultimediaDaoImpl.java

@Override
public Set<Multimedia> getAllMultimedia() {
    final TypedQuery<MultimediaImpl> query = this.createQuery(this.findAllMultimedia);
    return new LinkedHashSet<Multimedia>(query.getResultList());
}

From source file:com.ewcms.content.particular.dao.FrontProjectArticleDAO.java

public List<ProjectArticle> findProjectShenPiArticleLimit(String channelChildrens) {
    String hql = "From ProjectArticle As p where p.channelId in(" + channelChildrens
            + ") and p.release=true Order By p.published desc ";
    TypedQuery<ProjectArticle> query = this.getEntityManager().createQuery(hql, ProjectArticle.class);
    return query.getResultList();
}

From source file:eu.domibus.common.dao.ErrorLogDao.java

public List<ErrorLogEntry> findAll() {
    final TypedQuery<ErrorLogEntry> query = this.em.createNamedQuery("ErrorLogEntry.findEntries",
            ErrorLogEntry.class);
    return query.getResultList();
}