Examples of createQuery()


Examples of org.hibernate.Session.createQuery()

   * @param args
   * @return
   */
  protected static int executeUpdate(String hql, Object[] args){
    Session ssn = getSession();
    Query q = ssn.createQuery(hql);
    for(int i=0;args!=null&&i<args.length;i++){
      q.setParameter(i, args[i]);
    }
    return q.executeUpdate();
  }
View Full Code Here

Examples of org.hibernate.Session.createQuery()

   */
  protected static int commitUpdate(String hql, Object[] args){
    try{
      Session ssn = getSession();
      beginTransaction();
      Query q = ssn.createQuery(hql);
      for(int i=0;args!=null&&i<args.length;i++){
        q.setParameter(i, args[i]);
      }
      int er = q.executeUpdate();
      commit();
View Full Code Here

Examples of org.hibernate.Session.createQuery()

   * @param args
   * @return
   */
  protected static Object uniqueResult(String hql, Object[] args){
    Session ssn = getSession();
    Query q = ssn.createQuery(hql);
    for(int i=0;args!=null&&i<args.length;i++){
      q.setParameter(i, args[i]);
    }
    q.setMaxResults(1);
    return q.uniqueResult();
View Full Code Here

Examples of org.hibernate.Session.createQuery()

        hql.append("?,");
        hql2.append("?,");
      }
      hql.append("?)")
      hql2.append("?)");     
      Query q = ssn.createQuery(hql.toString());
      q.setInteger(0, siteid);
      i=0;
      for(;i<ids.length;i++){
        q.setInteger(i+1, ids[i]);
      }
View Full Code Here

Examples of org.hibernate.Session.createQuery()

      q.setInteger(i+1, ids[0]);
      List musics = q.list();
      if(musics.size()>0){
        beginTransaction();
        //����ռ��жԸ����ֵ�����
        Query q2 = ssn.createQuery(hql2.toString());
        i=0;
        q2.setParameter(0, null);
        for(;i<ids.length;i++){
          q2.setInteger(i+1, ids[i]);
        }
View Full Code Here

Examples of org.hibernate.Session.createQuery()

    @SuppressWarnings("unchecked")
  public static ProcessInstanceLog findProcessInstance(long processInstanceId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> result = session.createQuery(
            "from ProcessInstanceLog as log where log.processInstanceId = ?")
                .setLong(0, processInstanceId).list();
        session.getTransaction().commit();
        return result == null || result.size() == 0 ? null : result.get(0);
    }
View Full Code Here

Examples of org.hibernate.Session.createQuery()

    @SuppressWarnings("unchecked")
  public static List<NodeInstanceLog> findNodeInstances(long processInstanceId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<NodeInstanceLog> result = session.createQuery(
            "from NodeInstanceLog as log where log.processInstanceId = ?")
                .setLong(0, processInstanceId).list();
        session.getTransaction().commit();
        return result;
    }
View Full Code Here

Examples of org.hibernate.Session.createQuery()

    @SuppressWarnings("unchecked")
  public static List<NodeInstanceLog> findNodeInstances(long processInstanceId, String nodeId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<NodeInstanceLog> result = session.createQuery(
            "from NodeInstanceLog as log where log.processInstanceId = ? and log.nodeId = ?")
                .setLong(0, processInstanceId)
                .setString(1, nodeId).list();
        session.getTransaction().commit();
        return result;
View Full Code Here

Examples of org.hibernate.Session.createQuery()

  @SuppressWarnings("unchecked")
  public static void clear() {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> processInstances =
          session.createQuery("from ProcessInstanceLog").list();
        for (ProcessInstanceLog processInstance: processInstances) {
          session.delete(processInstance);
        }
        List<NodeInstanceLog> nodeInstances =
          session.createQuery("from NodeInstanceLog").list();
View Full Code Here

Examples of org.hibernate.Session.createQuery()

          session.createQuery("from ProcessInstanceLog").list();
        for (ProcessInstanceLog processInstance: processInstances) {
          session.delete(processInstance);
        }
        List<NodeInstanceLog> nodeInstances =
          session.createQuery("from NodeInstanceLog").list();
        for (NodeInstanceLog nodeInstance: nodeInstances) {
          session.delete(nodeInstance);
        }
        session.getTransaction().commit();
    }
View Full Code Here
TOP
Copyright © 2015 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.