List of usage examples for org.hibernate Query iterate
Iterator<R> iterate();
From source file:ch.algotrader.dao.AbstractDao.java
License:Open Source License
protected <V> List<V> find(final EntityConverter<E, V> converter, final String queryString, final QueryType type, final NamedParam... params) { Query query = prepareQuery(null, queryString, type, params); return convert(query.iterate(), converter); }
From source file:ch.algotrader.dao.AbstractDao.java
License:Open Source License
public <V> List<V> loadAll(EntityConverter<E, V> converter) { Validate.notNull(converter, "Entity converter is null"); Query query = createLoadAllQuery(); return convert(query.iterate(), converter); }
From source file:classes.Employee.java
public static java.util.Iterator iterateEmployeeByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From classes.Employee as Employee"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {// w w w . ja va 2 s.co m Query query = session.createQuery(sb.toString()); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:classes.Employee.java
public static java.util.Iterator iterateEmployeeByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From classes.Employee as Employee"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w w w. ja va2 s . co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("Employee", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:com.Accenture.DAO.feedbackDao.java
public List<feedbackpojo> findlocandgro(String email) { List<feedbackpojo> list = new ArrayList<>(); Session ses = null;/*from w ww .j av a 2 s .co m*/ SessionFactory sf = new org.hibernate.cfg.Configuration().configure().buildSessionFactory(); ses = sf.openSession(); ses.beginTransaction(); String HQL_QUERY = "from feedbackpojo feedback where email =:email"; org.hibernate.Query query = ses.createQuery(HQL_QUERY); query.setParameter("email", email); for (Iterator it = query.iterate(); it.hasNext();) { feedbackpojo b = (feedbackpojo) it.next(); b.getEmail(); list.add(b); } return list; }
From source file:com.Accenture.DAO.feedbackDao.java
public List<feedbackpojo> search0(String em) { List<feedbackpojo> result = new ArrayList<feedbackpojo>(); Session session = null;//from w ww . java2 s . c o m SessionFactory sessionfactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory(); session = sessionfactory.openSession(); session.beginTransaction(); String HQL_QUERY = "from feedbackpojo feedback where email='" + em + "'"; org.hibernate.Query query = session.createQuery(HQL_QUERY); for (Iterator it = query.iterate(); it.hasNext();) { feedbackpojo f = (feedbackpojo) it.next(); f.getFeedbackid(); f.getLid(); f.getFeedback(); f.getEmail(); result.add(f); } return result; }
From source file:com.Accenture.DAO.groupDao.java
public List<grouppojo> search(String search) { List<grouppojo> result = new ArrayList<grouppojo>(); Session session = null;//from w ww . j a v a 2 s .c o m SessionFactory sessionfactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory(); session = sessionfactory.openSession(); session.beginTransaction(); String HQL_QUERY = "from grouppojo groups where gname like '" + search + "%'"; org.hibernate.Query query = session.createQuery(HQL_QUERY); for (Iterator it = query.iterate(); it.hasNext();) { grouppojo l = (grouppojo) it.next(); l.getDuration(); l.getFinish(); l.getGname(); l.getGroupid(); l.getLocation(); l.getStart(); result.add(l); } return result; }
From source file:com.Accenture.DAO.learnerDao.java
public List<learnerspojo> getByEmail(String email) { List<learnerspojo> list = new ArrayList<>(); Session session = null;//w w w . j av a 2 s. c o m SessionFactory sessionfactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory(); session = sessionfactory.openSession(); session.beginTransaction(); String HQL_QUERY = "from learnerspojo l where email =" + email; org.hibernate.Query query = session.createQuery(HQL_QUERY); for (Iterator it = query.iterate(); it.hasNext();) { learnerspojo l = (learnerspojo) it.next(); l.getEmail(); l.getGender(); l.getGroups(); l.getId(); l.getLID(); l.getLName(); l.getLSurname(); l.getNumber(); l.getPassword(); l.getRace(); l.getStatus(); l.getTitle(); list.add(l); } return list; }
From source file:com.Accenture.DAO.learnerDao.java
public String checklogin(String email, String password) { String e = "", p = "", msg = ""; Session ses = null;/*from w w w .j a va 2 s . c om*/ SessionFactory sf = new org.hibernate.cfg.Configuration().configure().buildSessionFactory(); ses = sf.openSession(); ses.beginTransaction(); String HQL_QUERY = "from learnerspojo learners where email =:email and password =:password"; org.hibernate.Query query = ses.createQuery(HQL_QUERY); query.setParameter("email", email); query.setParameter("password", password); for (Iterator it = query.iterate(); it.hasNext();) { learnerspojo b = (learnerspojo) it.next(); e = b.getEmail(); p = b.getPassword(); } if (e.equals(email) && p.equals(password)) { msg = "yes"; } return msg; }
From source file:com.Accenture.DAO.learnerDao.java
public List<learnerspojo> search(int id) { List<learnerspojo> result = new ArrayList<learnerspojo>(); Session session = null;//from www . j a v a 2s .c om SessionFactory sessionfactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory(); session = sessionfactory.openSession(); session.beginTransaction(); String HQL_QUERY = "from learnerspojo l where lid=" + id; org.hibernate.Query query = session.createQuery(HQL_QUERY); for (Iterator it = query.iterate(); it.hasNext();) { learnerspojo l = (learnerspojo) it.next(); l.getEmail(); l.getGender(); l.getGroups(); l.getId(); l.getLID(); l.getLName(); l.getLSurname(); l.getNumber(); l.getPassword(); l.getRace(); l.getStatus(); l.getTitle(); result.add(l); } return result; }