List of usage examples for javax.persistence Query getResultList
List getResultList();
From source file:org.simbasecurity.core.domain.repository.UserDatabaseRepository.java
@SuppressWarnings("unchecked") @Override//from w ww . j a v a2s . c o m public Collection<User> findNotLinked(Role role) { Query query = entityManager.createQuery("SELECT user FROM UserEntity user WHERE :role not in " + "elements(user.roles) order by user.userName"); query.setParameter("role", role); return new ArrayList<User>(query.getResultList()); }
From source file:me.ronghai.sa.dao.impl.AbstractModelDAOWithEMImpl.java
@Override public List<E> find() { String jpql = "SELECT e FROM " + entityClass.getName() + " e"; Query query = entityManager.createQuery(jpql); return query.getResultList(); }
From source file:com.june.app.board.repository.jpa.BoardRepositoryImpl.java
@Override @SuppressWarnings("unchecked") public Collection<Board> boardList(Board vo) { String queryString = "SELECT board FROM Board board WHERE board.useYn ='Y'"; int bbsId = vo.getBbsId(); if (bbsId > 0) { queryString += "and board.bbsId = :bbsId"; }/*from w w w .jav a2s .c o m*/ Query query = this.em.createQuery(queryString); if (bbsId > 0) { query.setParameter("bbsId", bbsId); } return query.getResultList(); }
From source file:net.urlgrey.mythpodcaster.dao.MythRecordingsDAOImpl.java
@SuppressWarnings("unchecked") @Override/*from ww w . j a va2 s .c om*/ @Transactional(readOnly = true) public List<RecordedSeries> findAllRecordedSeries() { final Query namedQuery = entityManager.createNamedQuery("MYTH_RECORDINGS.findAllRecordedSeries"); final List<RecordedSeries> series = namedQuery.getResultList(); return series; }
From source file:ejb.bean.UsuarioDAOJPAImplBean.java
/**Mtodo para a busca de todos os usurios existentes no banco de dados. * @author Richel Sensineli/*w ww. j av a2 s . co m*/ * @param nome String - Nome do usurio * @return Collection list */ @Override public Collection buscaTodosUsuarios() { EntityManagerFactory emf = Persistence.createEntityManagerFactory("UsuarioPU"); EntityManager em = emf.createEntityManager(); Query q = em.createQuery("select u from UsuarioImpl u"); Collection result = null; result = q.getResultList(); em.clear(); em.close(); emf.close(); return result; }
From source file:com.sct.descubriendoturuta.service.InsigniaServiceImpl.java
@Override @Transactional// w ww . j a va 2 s.c o m public List<Insignia> obtenerInsigniasPor(int usuarioId, int tipo) { Query query = em.createQuery("select i from Insignia i Where i.usuario.id = :p and i.tipo = :t"); query.setParameter("p", usuarioId); query.setParameter("t", tipo); return query.getResultList(); }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.BaggageDaoImpl.java
@Override public List<Baggage> getByFlightTicket(Long ticket) { try {/*w w w .j a v a 2 s .co m*/ Query q = em.createQuery("FROM Baggage WHERE flight_ticket_id=:ticket"); q.setParameter("ticket", ticket); List<Baggage> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:org.openwms.wms.order.ShippingOrderDaoImpl.java
/** * {@inheritDoc}//from w ww .j a v a 2 s. com */ @Override public List<ShippingOrder> findInState(OrderState... state) { Query query = em.createNamedQuery(AbstractOrder.NQ_FIND_WITH_STATE) .setParameter(AbstractOrder.QP_FIND_WITH_STATE_STATE, Arrays.asList(state)); @SuppressWarnings("unchecked") List<ShippingOrder> result = query.getResultList(); return result == null ? Collections.<ShippingOrder>emptyList() : result; }
From source file:pdsanchez.mywebtools.model.dao.jpa.SubcategoryDAOJPAImpl.java
@Override public List<Subcategory> findAll(Category category) { Query q = getEntityManager().createQuery( "select distinct o.subcategory from Tool o where lower(o.category.categoryName) = :name and o.isvalid = 1"); q.setParameter("name", category.getCategoryName().toLowerCase()); return q.getResultList(); }
From source file:eu.planets_project.tb.impl.persistency.ServiceRecordPersistencyImpl.java
@SuppressWarnings("unchecked") public List<ServiceRecordImpl> getAllServiceRecordsByServiceName(String name) { Query query = manager.createQuery("from ServiceRecordImpl where serviceName=:name"); query.setParameter("name", name); return (List<ServiceRecordImpl>) query.getResultList(); }