Package org.hibernate

Examples of org.hibernate.Session.createQuery()


   
    @SuppressWarnings("unchecked")
  public static List<ProcessInstanceLog> findProcessInstances() {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> result = session.createQuery("from ProcessInstanceLog").list();
        session.getTransaction().commit();
        return result;
    }

    @SuppressWarnings("unchecked")
View Full Code Here


    @SuppressWarnings("unchecked")
  public static List<ProcessInstanceLog> findProcessInstances(String processId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> result = session.createQuery(
            "from ProcessInstanceLog as log where log.processId = ?")
                .setString(0, processId).list();
        session.getTransaction().commit();
        return result;
    }
View Full Code Here

    }

  public static List<ProcessInstanceLog> findActiveProcessInstances(String processId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> result = session.createQuery(
            "from ProcessInstanceLog as log where log.processId = ? AND log.end is null")
                .setString(0, processId).list();
        session.getTransaction().commit();
        return result;
    }
View Full Code Here

    }
   
    Session ssn = getSession();
   
    try{
      Query q = ssn.createQuery(hql.toString()).setCacheable(true);
      q.setTimestamp("beginTime", firstDate.getTime());
      q.setTimestamp("endTime", nextMonthFirstDate.getTime());
      q.setInteger("status", DiaryBean.STATUS_NORMAL);
      q.setInteger("site", site.getId());
      if(!site.isOwner(user)){
View Full Code Here

      hql.append(" AND j.catalog.id=:catalog");
    }
    hql.append(" ORDER BY j.id DESC");
    Session ssn = getSession();
    try{
      Query q = ssn.createQuery(hql.toString());
      q.setInteger("site", site.getId());
      q.setInteger("status", DiaryBean.STATUS_NORMAL);
      q.setInteger("diary", log_id);
      if(cat_id > 0)
        q.setInteger("catalog", cat_id);
View Full Code Here

      hql.append(" AND j.catalog.id=:catalog");
    }
    hql.append(" ORDER BY j.id ASC");
    Session ssn = getSession();
    try{
      Query q = ssn.createQuery(hql.toString());
      q.setInteger("site", site.getId());
      q.setInteger("status", DiaryBean.STATUS_NORMAL);
      q.setInteger("diary", log_id);
      if(cat_id > 0)
        q.setInteger("catalog", cat_id);
View Full Code Here

    if(year > 0 || month > 0 || date > 0){
      hql.append(" AND a.writeTime >= :beginTime AND a.writeTime < :endTime");
    }
    try {
      Session ssn = getSession();
      Query q = ssn.createQuery(hql.toString());
      q.setInteger("status", DiaryBean.STATUS_NORMAL);
      q.setInteger("site", site.getId());
      if(!site.isOwner(user)){
        q.setInteger("cat_type", CatalogBean.TYPE_OWNER);
        if(user != null){
View Full Code Here

      hql.append(" AND a.writeTime >= :beginTime AND a.writeTime < :endTime");
    }
    hql.append(" ORDER BY a.id DESC");
    try {
      Session ssn = getSession();
      Query q = ssn.createQuery(hql.toString());
      q.setInteger("status", DiaryBean.STATUS_NORMAL);
      q.setInteger("cat_type", CatalogBean.TYPE_OWNER);
      if(year > 0 || month > 0 || date > 0){
        Calendar[] cals = genTimeParams(year,month,date);
        q.setTimestamp("beginTime", cals[0].getTime());
View Full Code Here

      hql.append(" AND a.writeTime >= :beginTime AND a.writeTime < :endTime");
    }
    hql.append(" ORDER BY a.id DESC");
    try {
      Session ssn = getSession();
      Query q = ssn.createQuery(hql.toString());
      q.setInteger("status", DiaryBean.STATUS_NORMAL);
      q.setInteger("site", site.getId());
      if(user==null || site.getOwner().getId() != user.getId()){
        q.setInteger("cat_type", CatalogBean.TYPE_OWNER);
        if(user != null){
View Full Code Here

      hql.append(')');
      hql.append(" AND (r.ownerOnly = 0 OR r.user.id = :userid)");
    }
    hql.append(" ORDER BY r.id DESC");
    Session ssn = getSession();
    Query q = ssn.createQuery(hql.toString());
    q.setInteger("status", DiaryReplyBean.STATUS_NORMAL);
    q.setInteger("site", site.getId());
    q.setInteger("diary_status", DiaryOutlineBean.STATUS_NORMAL);
    if(!site.isOwner(user)){
      q.setInteger("cat_type", CatalogBean.TYPE_OWNER);
View Full Code Here

TOP
Copyright © 2018 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.