Package org.hibernate

Examples of org.hibernate.Query


      hql.append(" AND p.album.id=:album");
    if(month >= 190001 && month <= 209912){
      hql.append(" AND p.year = :year AND p.month = :month");
    }
    Session ssn = getSession();
    Query q = ssn.createQuery(hql.toString());
    q.setInteger("site", sid);
    if(album_id > 0)
      q.setInteger("album", album_id);
    if(month >= 190001 && month <= 209912){
      q.setInteger("year", month / 100);
      q.setInteger("month", month % 100);
    }
    try{
      Number size = (Number)q.uniqueResult();
      return (size!=null)?size.intValue():0;
    }finally{
      hql = null;
    }
  }
View Full Code Here


      hql.append(" AND j.status=:status AND j.album.type=:album_type");
    }
       
    try{
      Session ssn = getSession();
      Query q = ssn.createQuery(hql.toString()).setCacheable(true);
      q.setTimestamp("beginTime", firstDate.getTime());
      q.setTimestamp("endTime", nextMonthFirstDate.getTime());
      q.setInteger("site", site.getId());
      if(!is_owner){
        q.setInteger("status", PhotoBean.STATUS_NORMAL);
        q.setInteger("album_type", AlbumBean.TYPE_PUBLIC);
      }
      int total = 0;
      Iterator logs = q.list().iterator();
      while(logs.hasNext()){
        tempCal.setTime((Date)logs.next());
        int date = tempCal.get(Calendar.DATE);
        logCounts[date]++;
        total ++;
View Full Code Here

      hql.append(" AND r.photo.album.type=:album_type");
      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", PhotoReplyBean.STATUS_NORMAL);
    q.setInteger("photo_status", PhotoBean.STATUS_NORMAL);
    q.setInteger("site", site.getId());
    if(!is_owner){
      q.setInteger("album_type", AlbumBean.TYPE_PUBLIC);
      q.setInteger("userid", (user!=null)?user.getId():-1);
    }
    if(fromIdx>0)
      q.setFirstResult(fromIdx);
    if(count>0)
      q.setMaxResults(count);
    return q.list();
  }
View Full Code Here

 
  /**
   * Ǩ���ռǷ���
   */
  protected static void upgradeCatalogs(Session old_ssn, Session new_ssn){
    Query q = old_ssn.createQuery("FROM CatalogForm c ORDER BY c.id ASC");
    List catalogs = q.list();
   
    for(int i=0;i<catalogs.size();i++){
      CatalogForm cform = (CatalogForm)catalogs.get(i);
      CatalogBean cbean = new CatalogBean();
      cbean.setSite(site);
View Full Code Here

 
  /**
   * Ǩ���ռ�
   */
  protected static void upgradeLogs(Session old_ssn, Session new_ssn){
    Query q = old_ssn.createQuery("FROM LogForm c ORDER BY c.id ASC");
    List logs = q.list();
   
    for(int i=0;i<logs.size();i++){
      LogForm log = (LogForm)logs.get(i);
      DiaryBean dbean = new DiaryBean();
      dbean.setCatalog((CatalogBean)catalogids.get(new Integer(log.getCategory())));
View Full Code Here

 
  /**
   * Ǩ������
   */
  protected static void upgradeReplies(Session old_ssn, Session new_ssn){
    Query q = old_ssn.createQuery("FROM ReplyForm c ORDER BY c.id ASC");
    List replies = q.list();
   
    for(int i=0;i<replies.size();i++){
      ReplyForm rform = (ReplyForm)replies.get(i);
      DiaryReplyBean rbean = new DiaryReplyBean();
      rbean.getClient().setAddr("127.0.0.1");
View Full Code Here

 
  /**
   * �û�Ǩ��
   */
  protected static void upgradeUsers(Session old_ssn, Session new_ssn){
    Query q = old_ssn.createQuery("FROM UserForm u ORDER BY u.id ASC");
    List users = q.list();
   
    for(int i=0;i<users.size();i++){
      UserForm user = (UserForm)users.get(i)
      UserBean ubean = new UserBean();
      //���뵽ָ����site
View Full Code Here

  /**
   * ��������Ǩ��
   */
  protected static void upgradeLinks(Session old_ssn, Session new_ssn){
    Query q = old_ssn.createQuery("FROM LinkForm l ORDER BY l.id ASC");
    List links = q.list();   
    for(int i=0;i<links.size();i++){
      LinkForm link = (LinkForm)links.get(i)
      LinkBean lbean = new LinkBean();
      lbean.setCreateTime(link.getCreateTime());
      lbean.setSiteId(site.getId());
View Full Code Here

   * ����Ǩ��
   * @param old_ssn
   * @param new_ssn
   */
  protected static void upgradeMessages(Session old_ssn, Session new_ssn){
    Query q = old_ssn.createQuery("FROM MessageForm l ORDER BY l.id ASC");
    List msgs = q.list();   
    for(int i=0;i<msgs.size();i++){
      MessageForm msg = (MessageForm)msgs.get(i)
      MessageBean mbean = new MessageBean();
      mbean.setContent(msg.getContent());
      mbean.setReadTime(msg.getReadTime());
View Full Code Here

   * ��ǩǨ��
   * @param old_ssn
   * @param new_ssn
   */
  protected static void upgradeBookmarks(Session old_ssn, Session new_ssn){
    Query q = old_ssn.createQuery("FROM BookMarkBean l ORDER BY l.id ASC");
    List bmbs = q.list();   
    for(int i=0;i<bmbs.size();i++){
      BookMarkBean bm = (BookMarkBean)bmbs.get(i)
      BookmarkBean mbean = new BookmarkBean();
      mbean.setCreateTime(bm.getCreateTime());
      mbean.setOwner((UserBean)userids.get(new Integer(bm.getUserId())));
View Full Code Here

TOP

Related Classes of org.hibernate.Query

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