List of usage examples for javax.persistence TypedQuery getResultList
List<X> getResultList();
From source file:io.github.todolist.core.repository.impl.TodoRepositoryImpl.java
/** * {@inheritDoc}/*from www .j a v a2 s. c om*/ */ public List<Todo> getTodoListByUser(final long userId) { TypedQuery<Todo> query = entityManager.createNamedQuery("findTodosByUser", Todo.class); query.setParameter(1, userId); return query.getResultList(); }
From source file:fi.vm.kapa.identification.metadata.dao.MetadataDAO.java
public List<Metadata> getMetadataByEntityId(String entityId) { TypedQuery<Metadata> query = entityManager.createNamedQuery("Metadata.searchByEntityId", Metadata.class) .setParameter("entityId", entityId); return query.getResultList(); }
From source file:org.ualerts.fixed.repository.JpaRoomRepository.java
/** * {@inheritDoc}/* w w w . ja v a2 s .c o m*/ */ @Override public List<Room> findRoomsForBuilding(String buildingId) { TypedQuery<Room> query = getEntityManager().createNamedQuery("findRoomsForBuilding", Room.class) .setParameter("buildingId", buildingId); return query.getResultList(); }
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:edu.sabanciuniv.sentilab.sare.controllers.entitymanagers.PersistentDocumentStoreController.java
/** * Gets all UUIDs for {@code T} type document stores owned by the given owner. * @param em the {@link EntityManager} to use. * @param ownerId the ID of the owner./*from www . ja v a 2 s . c om*/ * @param entityClass the specific type of document stores to be retrieved; must be annotated with the {@link Entity} annotation. * @return a {@link List} containing {@link String} representations of the UUIDs. */ public <T extends PersistentDocumentStore> List<String> getAllUuids(EntityManager em, String ownerId, Class<T> entityClass) { Validate.notNull(em, CannedMessages.NULL_ARGUMENT, "em"); Validate.notNull(ownerId, CannedMessages.NULL_ARGUMENT, "ownerId"); Validate.notNull(entityClass, CannedMessages.NULL_ARGUMENT, "entityClass"); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<byte[]> cq = cb.createQuery(byte[].class); Root<T> store = cq.from(entityClass); cq.multiselect(store.get("id")) .where(cb.equal(store.get("ownerId"), cb.parameter(String.class, "ownerId"))); TypedQuery<byte[]> tq = em.createQuery(cq); tq.setParameter("ownerId", ownerId); return Lists.newArrayList(Iterables.transform(tq.getResultList(), UuidUtils.uuidBytesToStringFunction())); }
From source file:com.ewcms.content.particular.dao.FrontProjectBasicDAO.java
public List<ProjectBasic> findProjectShenPiBasicLimit(String shape, Integer number) { String hql = "From ProjectBasic As p where p.shape=:shape and p.release=true Order By p.buildTime desc limit " + number;/*ww w. jav a 2 s . co m*/ TypedQuery<ProjectBasic> query = this.getEntityManager().createQuery(hql, ProjectBasic.class); query.setParameter("shape", Shape.valueOf(shape)); return query.getResultList(); }
From source file:org.mitre.openid.connect.repository.impl.JpaBlacklistedSiteRepository.java
@Override @Transactional(value = "defaultTransactionManager") public Collection<BlacklistedSite> getAll() { TypedQuery<BlacklistedSite> query = manager.createNamedQuery(BlacklistedSite.QUERY_ALL, BlacklistedSite.class); return query.getResultList(); }
From source file:com.plan.proyecto.repositorios.DaoContenidoImpl.java
@Override public List<Contenido> findContenidosByCuenta(Long id) { TypedQuery<Contenido> query = em.createNamedQuery("Contenido.findByCuenta", Contenido.class); query.setParameter("valor", id); return query.getResultList(); }
From source file:nh.examples.springintegration.order.framework.domain.Repository.java
public List<T> getAll() { TypedQuery<T> query = _entityManager .createQuery(format("SELECT o FROM %s o", getAggregateType().getSimpleName()), getAggregateType()); return query.getResultList(); }