List of usage examples for org.hibernate.query Query setLong
@Deprecated @SuppressWarnings("unchecked") default Query<R> setLong(String name, long val)
From source file:com.testing.pe.dao.ApprovalDAO.java
public List<AccessRequest> getAllApprovedRequest(Long profileId) { Session session = this.sessionFactory.openSession(); Query createQuery = session .createQuery("from AccessRequest a where a.requester.id=:userId and a.approvalStatus=:status"); createQuery.setLong("userId", profileId); createQuery.setInteger("status", ApprovalStatus.APPROVED.ordinal()); List list = createQuery.list(); session.close();//from w w w . j ava 2s.co m return list; }
From source file:com.testing.pe.dao.ApprovalDAO.java
public List<AccessRequest> getAllPendingRequest(Long patientId) { Session session = this.sessionFactory.openSession(); Query createQuery = session.createQuery( "from AccessRequest a where a.prescription.patient.id=:userId and a.approvalStatus=:status"); createQuery.setLong("userId", patientId); createQuery.setInteger("status", ApprovalStatus.PENDING.ordinal()); List list = createQuery.list(); session.close();// w w w . j a v a 2 s . co m return list; }