List of usage examples for javax.persistence Query getResultList
List getResultList();
From source file:DAO.MessagesDAOImpl.java
@Transactional(readOnly = true) @Override//from ww w . jav a 2 s. c om public List<MessagesEntity> findAll() { Query q = em.createQuery("SELECT m FROM MessagesEntity m"); return q.getResultList(); }
From source file:org.prueba.jpa.UserDao.java
@SuppressWarnings("unchecked") public List<PersonaEmpresaUsuario> getAll() { //return entityManager.createQuery("SELECT p FROM PersonaEmpresaUsuario p WHERE p.ciRuc = '0923746663'").getResultList(); Query queryByName = entityManager.createNamedQuery("PersonaEmpresaUsuario.findByCiRuc"); queryByName.setParameter("ciRuc", "0923746663"); return queryByName.getResultList(); }
From source file:Professor.java
public void lockAllProfessors() { Query query = em.createQuery("SELECT e FROM Professor e"); //from w w w . j a v a 2s . c om for(Object employee: query.getResultList()){ em.lock(employee, LockModeType.READ); } }
From source file:bankconsoleapp.repositories.SavingDao.java
@Transactional public void deposit(String acnum, int amount) { int newBalance = 0; Query q1 = em.createQuery("From SavingAccount SA WHERE SA.accNum='" + acnum + "'"); List<SavingAccount> SA = q1.getResultList(); for (SavingAccount sav : SA) { newBalance = sav.getBalance() + amount; }//from w w w . ja va 2s.c o m Query q = em.createQuery("update SavingAccount set balance=:bal where accNum=:an"); q.setParameter("an", acnum); q.setParameter("bal", newBalance); q.executeUpdate(); em.flush(); }
From source file:bankconsoleapp.repositories.SavingDao.java
@Transactional public void withdraw(String acnum, int amount) { int newBalance = 0; Query q1 = em.createQuery("From SavingAccount SA WHERE SA.accNum='" + acnum + "'"); List<SavingAccount> SA = q1.getResultList(); for (SavingAccount sav : SA) { newBalance = sav.getBalance() - amount; }/*ww w . j a v a 2 s .co m*/ Query q = em.createQuery("update SavingAccount set balance=:bal where accNum=:an"); q.setParameter("an", acnum); q.setParameter("bal", newBalance); q.executeUpdate(); em.flush(); }
From source file:com.healthcit.cacure.dao.ModuleDao.java
/** * @return Cosistently ordered list of Modules *///from w w w. j a v a2s.c o m @SuppressWarnings("unchecked") public List<Module> getOrderedModuleList() { Query query = em.createQuery("select m from Module m order by m.description, m.id "); return query.getResultList(); }
From source file:org.syncope.core.persistence.dao.impl.ConnInstanceDAOImpl.java
@Override public List<ConnInstance> findAll() { Query query = entityManager.createQuery("SELECT e " + "FROM " + ConnInstance.class.getSimpleName() + " e"); return query.getResultList(); }
From source file:org.syncope.core.persistence.dao.impl.VirSchemaDAOImpl.java
@Override public <T extends AbstractVirSchema> List<T> findAll(final Class<T> reference) { Query query = entityManager.createQuery("SELECT e FROM " + reference.getSimpleName() + " e"); return query.getResultList(); }
From source file:Professor.java
public void lockAllProfessors() { Query query = em.createQuery("SELECT e FROM Professor e"); //from w w w . j a v a2 s . c o m for(Object employee: query.getResultList()){ em.lock(employee, LockModeType.WRITE); } }
From source file:org.syncope.core.persistence.dao.impl.DerSchemaDAOImpl.java
@Override public <T extends AbstractDerSchema> List<T> findAll(final Class<T> reference) { Query query = entityManager.createQuery("SELECT e FROM " + reference.getSimpleName() + " e"); return query.getResultList(); }