List of usage examples for javax.persistence TypedQuery setParameter
TypedQuery<X> setParameter(int position, Object value);
From source file:com.plan.proyecto.repositorios.DaoContenidoImpl.java
@Override public List<Comentario> findComentarioByCuenta(Cuenta cuenta) { if (cuenta == null) { return null; }/*ww w. jav a 2s . com*/ TypedQuery<Comentario> query = em.createNamedQuery("Comentario.findComentarioByCuenta", Comentario.class); query.setParameter("idValor", cuenta.getId()); return query.getResultList(); }
From source file:com.deltastar.task7.core.repository.api.impl.CustomerRepositoryImpl.java
@Override public List<Customer> findCustomerByUserNameOrFirstNameOrLastName(String userName, String firstName, String lastName) {/*from w w w . j a va 2 s.c o m*/ TypedQuery<Customer> query = entityManager.createNamedQuery("findCustomerByKeyWords", Customer.class); query.setParameter("p_userName", "%" + userName + "%"); query.setParameter("p_firstName", "%" + firstName + "%"); query.setParameter("p_lastName", "%" + lastName + "%"); return query.getResultList(); }
From source file:cz.muni.fi.dndtroops.dao.UserDaoImpl.java
@Override public User findByName(String name) { log.debug("findByName({})", name); if (name == null) { throw new IllegalArgumentException("name is null"); }// w w w . ja v a 2 s.com if (name.length() == 0) { throw new IllegalArgumentException("name is empty string"); } try { TypedQuery<User> query = em.createQuery("SELECT u FROM User u WHERE u.name = :name", User.class); return query.setParameter("name", name).getSingleResult(); } catch (NoResultException nre) { return null; } }
From source file:com.deltastar.task7.core.repository.api.impl.TransitionViewRepositoryImpl.java
@Override public List<TransitionView> getPendingTransitionList() { TypedQuery<TransitionView> query = entityManager.createNamedQuery("findTransitionViewByStatus", TransitionView.class); query.setParameter("p_status", CCConstants.TRAN_STATUS_PENDING); return query.getResultList(); }
From source file:com.ewcms.content.particular.dao.FrontEmployeArticleDAO.java
public List<EmployeArticle> findEmployeArticleBySector(Long organId) { String hql = "From EmployeArticle As p where p.organ.id=:organId and p.release=true Order By p.published desc "; TypedQuery<EmployeArticle> query = this.getEntityManager().createQuery(hql, EmployeArticle.class); query.setParameter("organId", Integer.valueOf(organId.toString())); return query.getResultList(); }
From source file:com.ewcms.content.particular.dao.FrontEmployeArticleDAO.java
public List<EmployeArticle> findEmployeArticleByCode(String code) { String hql = "From EmployeArticle As p where p.employeBasic.cardCode=:code and p.release=true Order By p.published desc "; TypedQuery<EmployeArticle> query = this.getEntityManager().createQuery(hql, EmployeArticle.class); query.setParameter("code", code); return query.getResultList(); }
From source file:com.ewcms.content.particular.dao.FrontEmployeArticleDAO.java
public List<EmployeArticle> findEmployeChannelArticleLimit(Integer channelId, Integer number) { String hql = "From EmployeArticle As p where p.channelId=:channelId and p.release=true Order By p.published desc limit " + number;//from w w w . j a v a 2 s . com TypedQuery<EmployeArticle> query = this.getEntityManager().createQuery(hql, EmployeArticle.class); query.setParameter("channelId", channelId); return query.getResultList(); }
From source file:com.expressui.sample.view.account.AccountQuery.java
@Override public void setParameters(TypedQuery typedQuery) { if (!isEmpty(name)) { typedQuery.setParameter("name", "%" + name.toUpperCase() + "%"); }//from ww w .j a va 2s .co m if (!isEmpty(states)) { typedQuery.setParameter("states", states); } if (!isEmpty(country)) { typedQuery.setParameter("country", country); } }
From source file:com.plan.proyecto.repositorios.DaoCuentaImpl.java
@Override public Cuenta findByEmailAndPassword(String email, String pwd) { TypedQuery<Cuenta> query = em.createNamedQuery("Cuenta.findByEmailAndPassword", Cuenta.class); query.setParameter("valorEmail", email); query.setParameter("valorPassword", pwd); List<Cuenta> lista = query.getResultList(); if (lista.isEmpty()) { return null; }// ww w . j a v a 2 s . co m return lista.get(0); }
From source file:com.epam.ipodromproject.repository.jpa.JPABetRepository.java
@Override public List<Bet> getBetsByCompetition(Long competitionID) { TypedQuery<Bet> query = entityManager.createNamedQuery("Bet.findByCompetitionID", Bet.class); query.setParameter("competitionID", competitionID); query.setParameter("betResult", BetResult.NOT_CONSIDERED); return query.getResultList(); }