List of usage examples for javax.persistence TypedQuery getResultList
List<X> getResultList();
From source file:org.osiam.resource_server.storage.dao.ExtensionDao.java
/** * Get all stored extensions.//from w ww . j a v a2 s . c o m * * @return all extensions. */ public List<ExtensionEntity> getAllExtensions() { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<ExtensionEntity> cq = cb.createQuery(ExtensionEntity.class); Root<ExtensionEntity> extension = cq.from(ExtensionEntity.class); cq.select(extension); TypedQuery<ExtensionEntity> query = em.createQuery(cq); return query.getResultList(); }
From source file:com.intera.roostrap.security.JpaUserDetailService.java
private List<GrantedAuthority> loadGrantedAuthorities(User targetUser) { List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); TypedQuery<UserRole> roleQuery = UserRole.findUserRolesByUser(targetUser); List<UserRole> userRoles = roleQuery.getResultList(); for (UserRole userRole : userRoles) { authorities.add(new SimpleGrantedAuthority(userRole.getRole().getName())); }// w w w .j a v a 2 s .com return authorities; }
From source file:br.pucminas.ri.jsearch.querylog.LogController.java
synchronized public List<Log> getAll() { createConnection();/*w ww . ja va 2 s . co m*/ TypedQuery<Log> query = em.createQuery("SELECT l FROM Log l", Log.class); List<Log> result = query.getResultList(); closeConnection(); return result; }
From source file:com.ewcms.content.particular.dao.FrontEnterpriseBasicDAO.java
public List<EnterpriseBasic> findEnterpriseBasicAll(Integer number) { if (number == null) { String hql = "From EnterpriseBasic As e where e.release=true Order By e.yyzzzch"; TypedQuery<EnterpriseBasic> query = this.getEntityManager().createQuery(hql, EnterpriseBasic.class); return query.getResultList(); } else {/*from w w w .jav a 2s .co m*/ String hql = "From EnterpriseBasic As e where e.release=true Order By e.yyzzzch limit " + number; TypedQuery<EnterpriseBasic> query = this.getEntityManager().createQuery(hql, EnterpriseBasic.class); return query.getResultList(); } }
From source file:com.github.springtestdbunit.entity.EntityAssert.java
public void assertValues(String... values) { SortedSet<String> expected = new TreeSet<String>(Arrays.asList(values)); SortedSet<String> actual = new TreeSet<String>(); TypedQuery<SampleEntity> query = this.entityManager.createQuery(this.criteriaQuery); List<SampleEntity> results = query.getResultList(); for (SampleEntity sampleEntity : results) { actual.add(sampleEntity.getValue()); this.entityManager.detach(sampleEntity); }/*from www.j a v a2s . com*/ assertEquals(expected, actual); }
From source file:org.broadleafcommerce.menu.dao.MenuDaoImpl.java
@Override public List<MenuItem> readAllMenuItems() { TypedQuery<MenuItem> q = new TypedQueryBuilder<MenuItem>(MenuItem.class, "mi").toQuery(em); return q.getResultList(); }
From source file:org.ualerts.fixed.repository.JpaBuildingRepository.java
/** * {@inheritDoc}// www . ja va 2 s. co m */ @Override public List<Building> findAllBuildings() { TypedQuery<Building> query = getEntityManager().createNamedQuery("findAllBuildings", Building.class); return query.getResultList(); }
From source file:com.ewcms.content.particular.dao.FrontProjectBasicDAO.java
public List<ProjectBasic> findProjectBasicAll(Integer number) { if (number == null) { String hql = "From ProjectBasic As e where e.release=true Order By e.buildTime desc "; TypedQuery<ProjectBasic> query = this.getEntityManager().createQuery(hql, ProjectBasic.class); return query.getResultList(); } else {/*from w w w . j a v a2 s. c o m*/ String hql = "From ProjectBasic As p where p.release=true Order By p.buildTime desc limit " + number; TypedQuery<ProjectBasic> query = this.getEntityManager().createQuery(hql, ProjectBasic.class); return query.getResultList(); } }
From source file:org.spring.data.gemfire.app.dao.provider.JpaUserDao.java
public List<User> findAll() { TypedQuery<User> userQuery = entityManager.createQuery(FIND_ALL_USER_HQL, User.class); return userQuery.getResultList(); }
From source file:com.deltastar.task7.core.repository.api.impl.EmployeeRepositoryImpl.java
@Override public List<Employee> getEmployeeList() { TypedQuery<Employee> query = entityManager.createNamedQuery("findAllEmployee", Employee.class); return query.getResultList(); }