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.SessionsServiceImpl.java

@Override
public List<Sessions> findBySpeaker(Speaker speaker) {
    TypedQuery<Sessions> query = em.createQuery("select s from Sessions s where s.speaker = ?1",
            Sessions.class);
    query.setParameter(1, speaker);//from  w  w w  .  j  a  v a2  s  .c o  m

    return query.getResultList();
}

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

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

From source file:org.mitre.oauth2.repository.impl.JpaSystemScopeRepository.java

@Override
@Transactional(value = "defaultTransactionManager")
public Set<SystemScope> getAll() {
    TypedQuery<SystemScope> query = em.createNamedQuery(SystemScope.QUERY_ALL, SystemScope.class);

    return new LinkedHashSet<>(query.getResultList());
}

From source file:com.sshdemo.common.schedule.generate.job.report.dao.EwcmsJobReportDAO.java

public List<EwcmsJobParameter> findByJobReportParameterById(final Long jobReportId) {
    String hql = "Select p From EwcmsJobReport o Join o.ewcmsJobParameters p Where o.id=:jobReportId";

    TypedQuery<EwcmsJobParameter> query = this.getEntityManager().createQuery(hql, EwcmsJobParameter.class);
    query.setParameter("jobReportId", jobReportId);

    return query.getResultList();
}

From source file:top.knos.user.UserRepositoryImpl.java

@Override
public List<User> findUsersByNameQuery(String value) {
    TypedQuery<User> tq = em.createQuery("select u from User u where u.username = ?1", User.class);
    tq.setParameter(1, value);/* w  w w.  ja  va  2  s.  co m*/
    return tq.getResultList();
}

From source file:com.vmware.demo.db.dao.OrganizationHandler.java

@Transactional
public List<IdentityProvider> getAllIdentityProviders() {
    TypedQuery<IdentityProvider> query = entityManager
            .createQuery("SELECT idp FROM IdentityProvider idp ORDER BY idp.id", IdentityProvider.class);
    return query.getResultList();
}

From source file:example.springdata.jpa.showcase.before.AccountServiceImpl.java

@Override
public List<Account> findByCustomer(Customer customer) {

    TypedQuery<Account> query = em.createQuery("select a from Account a where a.customer = ?1", Account.class);
    query.setParameter(1, customer);//from  w ww . ja va 2  s  . com

    return query.getResultList();
}

From source file:net.groupbuy.dao.impl.AreaDaoImpl.java

public List<Area> findRoots(Integer count) {
    String jpql = "select area from Area area where area.parent is null order by area.order asc";
    TypedQuery<Area> query = entityManager.createQuery(jpql, Area.class).setFlushMode(FlushModeType.COMMIT);
    if (count != null) {
        query.setMaxResults(count);/*w  w  w  . ja  v a 2s.com*/
    }
    return query.getResultList();
}

From source file:org.antbear.jee.wicket.persistence.PersonService.java

public Iterator<Person> iterator(int first, int count) {
    TypedQuery<Person> query = em.createNamedQuery("person.findall", Person.class);
    query.setFirstResult(first);//ww  w  . j  a v  a 2s .  c om
    query.setMaxResults(count);
    return query.getResultList().iterator();
}

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

public List<ArticleMain> findArticleMainListByChannel(Integer channelId) {
    String hql = "From ArticleMain As p where p.channelId=:channelId  Order By p.article.published desc ";
    TypedQuery<ArticleMain> query = this.getEntityManager().createQuery(hql, ArticleMain.class);
    query.setParameter("channelId", channelId);
    return query.getResultList();
}