List of usage examples for org.hibernate Query setString
@Deprecated @SuppressWarnings("unchecked") default Query<R> setString(String name, String val)
From source file:celepsa.rrcc.da.AgrupacionDA.java
public List<Tmstakeagrupacion> buscarAgrupacionVarios(String AsuntoBuscado) throws Exception { try {/*from w ww .j a va 2 s. com*/ logger.debug("buscarAgrupacionVarios"); org.hibernate.Transaction tx = session.beginTransaction(); Query query = session.createQuery(" from Tmstakeagrupacion WHERE est=0 and nombre like :nombre "); query.setString("nombre", "%" + AsuntoBuscado + "%"); return query.list(); } catch (NumberFormatException | HibernateException e) { logger.error(e.getMessage()); throw e; } }
From source file:celepsa.rrcc.da.DocumentoDA.java
public List<Tmdocumento> buscarDocumentosVarios(String AsuntoBuscado) throws Exception { try {//from w w w . j a v a 2 s .co m logger.debug("buscarDocumentosVarios"); org.hibernate.Transaction tx = session.beginTransaction(); Query query = session.createQuery("from Tmdocumento where eliminado='0' and asunto like :asunto "); query.setString("asunto", "%" + AsuntoBuscado + "%"); return query.list(); } catch (HibernateException e) { logger.error(e.getMessage()); throw e; } }
From source file:celepsa.rrcc.da.PersonaDA.java
public boolean obtenerPersonaNDOC(Tmstakepersona objPersona) throws Exception { try {/*from w ww .j a va2s . c o m*/ boolean a = false; String sQuery = "FROM Tmstakepersona WHERE nroDocumento = :NDocumento "; org.hibernate.Transaction tx = session.beginTransaction(); Query query = session.createQuery(sQuery); query.setString("NDocumento", objPersona.getNroDocumento()); List<Object[]> res = query.list(); res = query.list(); if (res.isEmpty()) { a = true; } return a; } catch (HibernateException e) { logger.error(e.getMessage()); throw e; } }
From source file:celepsa.rrcc.da.PersonaDA.java
public List<Tmstakepersona> buscarPersonasVarios(String nombreBuscado) throws Exception { String sQuery = "FROM " + "Tmstakepersona WHERE est=0 and Nombre like :nombreBuscado or Apellido like :nombreBuscado "; try {//from ww w.j a v a2s . co m logger.debug("buscarPersonasVarios"); org.hibernate.Transaction tx = session.beginTransaction(); Query query = session.createQuery(sQuery); query.setString("nombreBuscado", "%" + nombreBuscado + "%"); logger.debug("buscarPersonasVarios End"); return query.list(); } catch (NumberFormatException | HibernateException e) { logger.error(e.getMessage()); throw e; } }
From source file:chitchatserver.FriendDAO.java
public static List<Friend> getFriend(String userid) { List<Friend> rs = null; Session session = HibernateUtil.getSessionFactory().openSession(); try {//from w w w.j a v a2 s.co m String hql = "from Friend f where f.userId=:userId"; Query query = session.createQuery(hql); query.setString("userId", userid); rs = query.list(); } catch (Exception ex) { System.out.println("Error getting friend list"); } finally { session.close(); } return rs; }
From source file:chitchatserver.UserConversationDAO.java
public static List<UserConversation> getUserConversation(String userId) { List<UserConversation> rs = null; Session session = HibernateUtil.getSessionFactory().openSession(); try {// w w w . java 2 s . co m String hql = "from UserConversation u where u.userId=:userId"; Query query = session.createQuery(hql); query.setString("userId", userId); rs = query.list(); } catch (Exception ex) { System.out.println("Error getting UserConversation" + ex.getMessage()); } finally { session.close(); } return rs; }
From source file:chitchatserver.UserDAO.java
public static boolean signIn(User user) { User u = getUser(user.getId());//from w ww .java2 s . c om if (u == null || u.getStatus().equals("Online")) { return false; } Session session = HibernateUtil.getSessionFactory().openSession(); try { List<User> temp = null; String hql = "from User u where u.id=:userId and u.pass=:userPass"; Query query = session.createQuery(hql); query.setString("userId", user.getId()); query.setString("userPass", user.getPass()); temp = query.list(); if (temp.size() == 0) { return false; } } catch (Exception ex) { System.out.println(ex.getMessage()); } finally { session.close(); } return true; }
From source file:cl.vmetrix.operation.persistence.OperationDAOImpl.java
License:Open Source License
@Override public void deleteCashflow(Cashflow cashflow) { // sessionFactory.getCurrentSession().delete(cashflow); Query query = sessionFactory.getCurrentSession() .createQuery("delete Cashflow where TRANSACTION_PROCESS_DATE = :date"); query.setString("date", String.valueOf(cashflow.getProcessDate())); query.executeUpdate();/* w ww. j a v a 2 s. co m*/ cashflow = null; query = null; }
From source file:cl.vmetrix.operation.persistence.OperationDAOImpl.java
License:Open Source License
@Override public void deleteInterest(Interest interest) { // sessionFactory.getCurrentSession().delete(interest); Query query = sessionFactory.getCurrentSession() .createQuery("delete Interest where TRANSACTION_PROCESS_DATE = :date"); query.setString("date", String.valueOf(interest.getProcessDate())); query.executeUpdate();/*from w w w .ja v a 2 s. com*/ interest = null; query = null; }
From source file:cl.vmetrix.operation.persistence.OperationDAOImpl.java
License:Open Source License
@Override public void deleteEquivCred(EquivalenteCredito equvCred) { // sessionFactory.getCurrentSession().delete(equvCred); Query query = sessionFactory.getCurrentSession() .createQuery("delete EquivalenteCredito where TRANSACTION_PROCESS_DATE = :date"); query.setString("date", String.valueOf(equvCred.getProcessDate())); query.executeUpdate();// ww w .ja v a2s.c om equvCred = null; query = null; }