List of usage examples for javax.persistence TypedQuery setParameter
TypedQuery<X> setParameter(int position, Object value);
From source file:puma.application.webapp.documents.DocumentDAOImpl.java
@Override public List<Document> getDocumentsByDestination(String destination) { TypedQuery<Document> query = em.createNamedQuery("documentsByDestination", Document.class); query.setParameter("destination", destination); List<Document> results = query.getResultList(); return results; }
From source file:puma.application.webapp.documents.DocumentDAOImpl.java
@Override public List<Document> getDocumentsByCreatingTenant(String tenantId) { TypedQuery<Document> query = em.createNamedQuery("documentsByCreatingTenant", Document.class); query.setParameter("creatingTenant", tenantId); List<Document> results = query.getResultList(); return results; }
From source file:com.jcs.goboax.aulavirtual.dao.impl.UsuarioDaoImpl.java
@Override public Usuario findByEmail(String anEmail) { TypedQuery<Usuario> myQuery = entityManager.createNamedQuery(Usuario.USUARIO_BY_EMAIL, entityClass); myQuery.setParameter(Usuario.USUARIO_EMAIL_PARAMETER, anEmail); try {/*from w w w. j a v a2 s. c o m*/ return myQuery.getSingleResult(); } catch (NoResultException e) { throw new AulaVirtualPersistenceException("No Result for Query", e); } catch (NonUniqueResultException e) { throw new AulaVirtualPersistenceException("More than one result", e); } }
From source file:com.ewcms.content.particular.dao.FrontEmployeBasicDAO.java
public List<EmployeBasic> findEmployeBasicBySector(Long organId) { String hql = "From EmployeBasic As p where p.organ.id=:organId and p.release=true Order By p.published desc "; TypedQuery<EmployeBasic> query = this.getEntityManager().createQuery(hql, EmployeBasic.class); query.setParameter("organId", Integer.valueOf(organId.toString())); return 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:com.web.mavenproject6.service.GuestServiceImp.java
@Override public Object findByAccessNumber(String accessNumber) { TypedQuery query = em.createQuery("select g from guest g where g.accessNumber = ?1", guest.class); query.setParameter(1, accessNumber); try {//from ww w .j av a 2 s . c om return query.getSingleResult(); } catch (Exception ee) { return false; } }
From source file:com.ushahidi.swiftriver.core.api.dao.impl.JpaUserDao.java
public User findByUsernameOrEmail(String search) { String qlString = "FROM User u WHERE email = :email OR username = :username"; TypedQuery<User> query = em.createQuery(qlString, User.class); query.setParameter("email", search); query.setParameter("username", search); User user = null;/*from www . j av a2 s.c o m*/ try { user = query.getSingleResult(); } catch (NoResultException e) { logger.info("No user with email {} or username {} exists", search, search); } return user; }
From source file:com.ewcms.content.particular.dao.FrontEmployeBasicDAO.java
public EmployeBasic findEmployeBasicByCardCode(final String cardCode) { String hql = "From EmployeBasic As p Where p.cardCode=:cardCode"; TypedQuery<EmployeBasic> query = this.getEntityManager().createQuery(hql, EmployeBasic.class); query.setParameter("cardCode", cardCode); EmployeBasic employeBasic = null;//from w w w .j a va 2 s . com try { employeBasic = (EmployeBasic) query.getSingleResult(); } catch (NoResultException e) { } return employeBasic; }
From source file:com.ewcms.content.particular.dao.FrontEnterpriseBasicDAO.java
public List<EnterpriseBasic> findEnterpriseBasicBySector(Long organId) { String hql = "From EnterpriseBasic As p where p.organ.id=:organId and p.release=true Order By p.published desc "; TypedQuery<EnterpriseBasic> query = this.getEntityManager().createQuery(hql, EnterpriseBasic.class); query.setParameter("organId", Integer.valueOf(organId.toString())); return query.getResultList(); }
From source file:com.sshdemo.common.schedule.generate.job.report.dao.EwcmsJobReportDAO.java
public EwcmsJobReport findJobReportByReportId(final Long reportId, final String reportType) { String hql = "Select o From EwcmsJobReport o Inner Join "; if (reportType.equals("text")) { hql += " o.textReport c "; } else if (reportType.equals("chart")) { hql += " o.chartReport c "; }/*from ww w. j a v a2 s .c o m*/ hql += " Where c.id=:reportId "; TypedQuery<EwcmsJobReport> query = this.getEntityManager().createQuery(hql, EwcmsJobReport.class); query.setParameter("reportId", reportId); EwcmsJobReport ewcmsJobReport = null; try { ewcmsJobReport = (EwcmsJobReport) query.getSingleResult(); } catch (NoResultException e) { } return ewcmsJobReport; }