Java Code Examples for org.hibernate.Query.setMaxResults()

The following are Jave code examples for showing how to use setMaxResults() of the org.hibernate.Query class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: unitimes   File: ChangeLog.java   Source Code and License Vote up 7 votes
public static List findLastNChanges(Long sessionId, Long managerId, Long subjAreaId, Long departmentId, int n) {
    try {
        org.hibernate.Session hibSession = new ChangeLogDAO().getSession(); 
        Query q = hibSession.createQuery(
                    "select ch from ChangeLog ch where " +
                    "ch.session.uniqueId=:sessionId " +
                    (managerId==null?"":"and ch.manager.uniqueId=:managerId ") +
                    (subjAreaId==null?"":"and ch.subjectArea.uniqueId=:subjAreaId ") +
                    (departmentId==null?"":"and ch.department.uniqueId=:departmentId ") + 
                    "order by ch.timeStamp desc");
        q.setLong("sessionId", sessionId.longValue());
        if (managerId!=null) q.setLong("managerId",managerId.longValue());
        if (subjAreaId!=null) q.setLong("subjAreaId",subjAreaId.longValue());
        if (departmentId!=null) q.setLong("departmentId",departmentId.longValue());
        q.setMaxResults(n);
        q.setCacheable(true);
        return q.list();
    } catch (Exception e) {
        Debug.error(e);
    }
    return null;
}
 
Example 2
Project: lams   File: GradebookDAO.java   Source Code and License Vote up 6 votes
@Override
   /**
    * @see org.lamsfoundation.lams.usermanagement.service.IUserManagementService#getUsersFromOrganisation(int)
    */
   public List<User> getUsersFromOrganisation(Integer orgId, int page, int size, String sortOrder,
    String searchString) {
final String LOAD_LEARNERS_BY_ORG = "SELECT uo.user FROM UserOrganisation uo"
	+ " WHERE uo.organisation.organisationId=:orgId"
	+ " AND CONCAT(uo.user.lastName, ' ', uo.user.firstName) LIKE CONCAT('%', :searchString, '%') "
	+ " ORDER BY uo.user.lastName " + sortOrder + " , uo.user.firstName " + sortOrder;

Query query = getSession().createQuery(LOAD_LEARNERS_BY_ORG);
query.setLong("orgId", orgId);
// support for custom search from a toolbar
searchString = searchString == null ? "" : searchString;
query.setString("searchString", searchString);
query.setFirstResult(page * size);
query.setMaxResults(size);
return query.list();
   }
 
Example 3
Project: sjk   File: AppHistory4IndexDaoImpl.java   Source Code and License Vote up 6 votes
@Override
public List<AppHistory4Index> getApps(int currentPage, int pageSize) {
    String hql = "from AppHistory4Index appIdx where appIdx.indexStatus<>1";

    Session session = null;
    try {
        session = this.sessions.openSession();

        Query q = session.createQuery(hql);
        q.setFirstResult(HibernateHelper.firstResult(currentPage, pageSize));
        q.setMaxResults(pageSize);
        return HibernateHelper.list(q);
    } catch (Exception e) {
        logger.error("error:", e);
        return null;
    } finally {
        if (session != null && session.isOpen()) {
            session.clear();
            session.close();
        }
    }
}
 
Example 4
Project: lams   File: EventDAOHibernate.java   Source Code and License Vote up 6 votes
@Override
   @SuppressWarnings("unchecked")
   public List<Subscription> getLessonEventSubscriptions(Long lessonId, Integer userId, boolean pendingOnly,
    Integer limit, Integer offset) {
String query = EventDAOHibernate.GET_LESSON_EVENT_SUBSCRIPTIONS;
if (lessonId != null) {
    query += " AND s.event.eventSessionId = ?";
}
if (pendingOnly) {
    query += " AND (s.lastOperationMessage IS NULL OR s.lastOperationMessage != '"
	    + DeliveryMethodNotification.LAST_OPERATION_SEEN + "')";
}
query += " ORDER BY ISNULL(s.lastOperationMessage) DESC, uid DESC";
Query queryObject = getSession().createQuery(query);
queryObject.setInteger(0, userId);
if (lessonId != null) {
    queryObject.setLong(1, lessonId);
}
if (limit != null) {
    queryObject.setMaxResults(limit);
}
if (offset != null) {
    queryObject.setFirstResult(offset);
}
return queryObject.list();
   }
 
Example 5
Project: Equella   File: FavouriteSearchDaoImpl.java   Source Code and License Vote up 6 votes
@Override
public void processQuery(Query query)
{
	if( freetext != null )
	{
		query.setParameter("freetext", freetext); //$NON-NLS-1$
	}
	if( dates != null )
	{
		if( dates[0] != null )
		{
			query.setParameter("start", dates[0]); //$NON-NLS-1$
		}
		if( dates[1] != null )
		{
			query.setParameter("end", dates[1]); //$NON-NLS-1$
		}
	}
	query.setParameter("owner", userId);
	query.setParameter("institution", institution);

	query.setFirstResult(offset);
	query.setFetchSize(max);
	query.setMaxResults(max);
}
 
Example 6
Project: ImageClassify   File: TaskService.java   Source Code and License Vote up 6 votes
/**
 * 获取该用户未提交或者未完成的任务
 */
@Override
public List<Task> geTasksOfUnfinished(int user_id,int start,int num) { 
	List<Task> tasks = new ArrayList<Task>();  
	Session session = HibernateUtils.getSession();//生成Session实例
	 Transaction tx = session.beginTransaction();//生成事务实例
	 try {
		 Query query =  session.createQuery("SELECT  new Task( task_id,task_img_amount,task_start_time,user_id) FROM Task WHERE task_iscommit = 0 AND user_id = "+user_id);
		 query.setFirstResult(start-1);
		 query.setMaxResults(num);
		 tasks = query.list();
	     tx.commit();//提交事务
	} catch (Exception e) {
		e.printStackTrace();
		tx.rollback();//事务回滚
	}finally{
		HibernateUtils.closeSession();//关闭session实例
	}
	 return tasks;  
}
 
Example 7
Project: admin-shiro   File: DaoSupport.java   Source Code and License Vote up 5 votes
/**
 * 获取单个实体,根据查询语句及参数获取。
 * 查询列名的别名跟实体必须完全一致(如 select a.uid as uid ao Admin as a , AdminRole as ar where a.uid=ar.adminId and a.uid=?
 */
public <T> T getSingleByHql(Class<T> clazz, CharSequence queryString, Object... params) {
    Query query = getSession().createQuery(queryString.toString());
    setParameter(query, params);
    query.setMaxResults(1);
    query.setResultTransformer(Transformers.aliasToBean(clazz));
    List<T> list = query.list();
    if (list.isEmpty()) {
        return null;
    }
    return list.get(0);
}
 
Example 8
Project: lams   File: OrganisationDAO.java   Source Code and License Vote up 5 votes
@SuppressWarnings("unchecked")
   @Override
   public List<Organisation> getPagedCourses(Integer parentOrgId, Integer typeId, Integer stateId, int page, int size,
    String sortBy, String sortOrder, String searchString) {
String sortByParam = "o.name";
switch (sortBy) {
    case "id":
	sortByParam = "o.organisationId";
	break;
    case "name":
	sortByParam = "o.name";
	break;
    case "code":
	sortByParam = "o.code";
	break;
    case "description":
	sortByParam = "o.createDate";
	break;
}

Query query = getSession().createQuery(OrganisationDAO.GET_PAGED_COURSES + sortByParam + " " + sortOrder);
query.setInteger("typeId", typeId);
query.setInteger("stateId", stateId);
query.setInteger("parentOrgId", parentOrgId);
// support for custom search from a toolbar
searchString = searchString == null ? "" : searchString;
query.setString("searchString", searchString);
query.setFirstResult(page * size);
query.setMaxResults(size);
return query.list();
   }
 
Example 9
Project: ImageClassify   File: ImageService.java   Source Code and License Vote up 5 votes
@Override
public List<Image_Composition> getPriorityImages(List<Integer> imgIds,int task_img_amount,String orderOfTime,String orderOfAmount) {
	 List<Image_Composition> marks = new ArrayList<Image_Composition>();
	 Session session = HibernateUtils.getSession();//生成Session实例
	 Transaction tx = session.beginTransaction();//生成事务实例
	 //此处img_ids不为空
	 String imgIdsString = "(";
	 for (int i = 0; i < imgIds.size()-1; i++) {
		imgIdsString += imgIds.get(i)+","; 
	 }
	 imgIdsString +=imgIds.get(imgIds.size()-1)+")";
	 try { 
	    Query query = session.createSQLQuery("SELECT img_id,img_machine_tag_label,img_path,img_name"
	    		+ " FROM image_composition WHERE img_id IN "+imgIdsString + " ORDER BY image_composition.upload_time "+orderOfTime +",image_composition.amount " +orderOfAmount)
	    		.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);  
		    query.setFirstResult(0);
		    query.setMaxResults(task_img_amount);
	    marks = query.list();
	     //调用session的get()方法,找到此用户到内存中
	    tx.commit();//提交事务
	} catch (Exception e) {
		e.printStackTrace();
		tx.rollback();//事务回滚
	}finally{
		HibernateUtils.closeSession();//关闭session实例
	} 
	 List<Image_Composition> marks2 = new ArrayList<Image_Composition>(); 
	 
	 for (int i = 0; i < marks.size(); i++) { 
		 Image_Composition image_Composition = new Image_Composition();
		  Map map = (Map) marks.get(i);
		  //img_machine_tag_label,img_path,img_name,user_id,img_id
		  image_Composition.setImg_id(Integer.parseInt(map.get("img_id")+""));
		  image_Composition.setImg_machine_tag_label(map.get("img_machine_tag_label")+"");
		  image_Composition.setImg_name(map.get("img_name")+"");
		  image_Composition.setImg_path(map.get("img_path")+"");
		   marks2.add(image_Composition);
	 }  
	 return marks2;  
}
 
Example 10
Project: lams   File: LearnerProgressDAO.java   Source Code and License Vote up 5 votes
@SuppressWarnings("unchecked")
   @Override
   public List<User> getLearnersLatestCompletedForLesson(Long lessonId, Integer limit, Integer offset) {
Query query = getSession().createQuery(LearnerProgressDAO.LOAD_LEARNERS_LATEST_COMPLETED_BY_LESSON)
	.setLong("lessonId", lessonId);
if (limit != null) {
    query.setMaxResults(limit);
}
if (offset != null) {
    query.setFirstResult(offset);
}
return query.list();
   }
 
Example 11
Project: ImageClassify   File: CompositionService.java   Source Code and License Vote up 5 votes
/**
 * 获取指定task_id对应的任务所有图片
 */
@Override
public List<Image> getTaskOfImages(int task_id) {
	
	 List<Image> images = new ArrayList<Image>();
	 Session session = HibernateUtils.getSession();//生成Session实例
	 Transaction tx = session.beginTransaction();//生成事务实例 
	 try { 
	    Query query = session.createSQLQuery("SELECT  image.img_id,img_name,img_path FROM composition,image WHERE composition.img_id = image.img_id AND composition.task_id = "+task_id).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); 
		    query.setFirstResult(0);
		    query.setMaxResults(5);
	    images = query.list();
	     //调用session的get()方法,找到此用户到内存中
	    tx.commit();//提交事务
	} catch (Exception e) {
		e.printStackTrace();
		tx.rollback();//事务回滚
	}finally{
		HibernateUtils.closeSession();//关闭session实例
	}    
	 List<Image> images2 = new ArrayList<Image>(); 
	 
	 for (int i = 0; i < images.size(); i++) { 
		  Image image = new Image();
		  Map map = (Map) images.get(i); 
		  image.setImg_id(Integer.parseInt(map.get("img_id")+"")); 
		  image.setImg_name(map.get("img_name")+"");
		  image.setImg_path(map.get("img_path")+"");
		  images2.add(image);
	 }  
	 return images2;
}
 
Example 12
Project: ImageClassify   File: ImageService.java   Source Code and License Vote up 5 votes
@Override
public List<Integer> seleteListOfCategory(int category_id,int user_id,String orderOfTime,String orderOfAmount) {
	Session session = HibernateUtils.getSession(); //生成session实例
    Transaction tx = session.beginTransaction();  //创建transaction实例
    List<Integer> imgIds = new ArrayList<Integer>();
    ListToString listToString = new ListToString();
    try {   
    	String hql = "SELECT image_category.img_id FROM image_category,image,image_composition WHERE image_category.img_id = image.img_id AND image.img_id = image_composition.img_id AND image.img_is_finish <> 1 AND  category_id ="+category_id;
    	String hql2 = " AND image.img_id NOT IN";
    	String hq3 = "SELECT img_id FROM mark WHERE user_id = "+user_id; 
    	String append = " ORDER BY image_composition.upload_time "+ orderOfTime + ",image_composition.amount " + orderOfAmount;
    List<Integer> integers  = session.createSQLQuery(hq3).list(); 
    if (!integers.isEmpty()) {
		hql = hql + hql2 + listToString.getListToString(integers) + append;
	}else {
		hql = hql + append;
	}
    Query query = session.createSQLQuery(hql);
    query.setFirstResult(0);
	query.setMaxResults(30);
    imgIds = query.list();
    tx.commit();            //提交事务  
	} catch (Exception e) {
		e.printStackTrace();
		tx.rollback();          //回滚事务 
	}finally {
	  HibernateUtils.closeSession();  //关闭Session实例
	} 
    return imgIds;
}
 
Example 13
Project: jshERP   File: DepotHeadDAO.java   Source Code and License Vote up 5 votes
@SuppressWarnings("unchecked")
public void findInDetail(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids) throws JshException {
    StringBuffer queryString = new StringBuffer();
    queryString.append("select dh.Number,m.`name`,m.Model,di.UnitPrice,di.OperNumber,di.AllPrice,s.supplier,d.dName,date_format(dh.OperTime, '%Y-%m-%d') " +
            "from jsh_depothead dh inner join jsh_depotitem di on di.HeaderId=dh.id " +
            "inner join jsh_material m on m.id=di.MaterialId " +
            "inner join jsh_supplier s on s.id=dh.OrganId " +
            "inner join (select id,name as dName from jsh_depot) d on d.id=di.DepotId " +
            "where dh.Type='"+ type +"' and dh.OperTime >='"+ beginTime +"' and dh.OperTime <='"+ endTime +"' ");
    if(pid!=null){
        queryString.append(" and di.DepotId=" + pid );
    }
    else {
        queryString.append(" and di.DepotId in (" + dids + ")" );
    }
    queryString.append(" ORDER BY OperTime DESC,Number desc");
    Query query;
    query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
    pageUtil.setTotalCount(query.list().size());
    // 分页查询
    int pageNo = pageUtil.getCurPage();
    int pageSize = pageUtil.getPageSize();
    if (0 != pageNo && 0 != pageSize) {
        query.setFirstResult((pageNo - 1) * pageSize);
        query.setMaxResults(pageSize);
    }
    pageUtil.setPageList(query.list());
}
 
Example 14
Project: SandBoxNGSB   File: QuoteDAOImpl.java   Source Code and License Vote up 5 votes
@Override
public QuotePE getFromDate(Date dateStartStep, Date dateEndStep){
	Session session = getSession();
	String requete = "FROM QuotePE "
			+ "WHERE creationDateTime <= :dateMin "
			+ "AND creationDateTime > :dateMax "
			+ "ORDER BY creationDateTime ASC ";
	
	Query query = session.createQuery(requete);
	
	query.setTimestamp("dateMin", dateStartStep);
	query.setTimestamp("dateMax", dateEndStep);
	query.setFirstResult(0);
	query.setMaxResults(1);
	query.uniqueResult();
	
	List<QuotePE> lpe = (List<QuotePE>) query.list();
	

	session.close();
	
	if(lpe.isEmpty())
		return null;
	else 
		return lpe.get(0);
	
	
}
 
Example 15
Project: lams   File: LessonDAO.java   Source Code and License Vote up 5 votes
@Override
   @SuppressWarnings("unchecked")
   public List<Long> getPreviewLessons(Integer limit) {
Query query = getSession().createQuery(FIND_PREVIEW_LESSON_IDS);
if (limit != null) {
    query.setMaxResults(limit);
}
return query.list();
   }
 
Example 16
Project: unitimes   File: LastChangesBackend.java   Source Code and License Vote up 4 votes
private List<ChangeLog> findChangeLog(LastChangesRequest request) {
	String from = "ChangeLog l";
	
	String where = "l.objectType = :type and l.objectUniqueId = :id";
	
	String groupBy = null;
	
	String orderBy = "l.timeStamp desc";
	
	if (Location.class.getName().equals(request.getObjectType())) {
		if ("true".equalsIgnoreCase(request.getOption("multi-session"))) {
			from = "ChangeLog l, Location r1, Location r2";
			where = "l.objectType in (:type, :roomType, :locType) and r1.uniqueId = :id and r2.permanentId = r1.permanentId and r2.uniqueId = l.objectUniqueId";
		} else {
			where = "l.objectType in (:type, :roomType, :locType) and l.objectUniqueId = :id";
		}
	}

	if (request.hasOption("operation")) {
		where += " and l.operationString = :operation";
	}
	
	if (request.hasOption("page")) {
		where += " and l.sourceString = :source";
	}
	
	String query = "select l from " + from + " where " + where + (groupBy == null ? "" : " group by " + groupBy ) + " order by " + orderBy;
	
	Query q = ChangeLogDAO.getInstance().getSession().createQuery(query);
	
	if (request.hasOption("limit"))
		q.setMaxResults(Integer.valueOf(request.getOption("limit")));
	else
		q.setMaxResults(ApplicationProperty.LastChangesLimit.intValue());
	
	if (request.hasOption("operation")) {
		q.setString("operation", request.getOption("operation").toUpperCase());
	}
	
	if (request.hasOption("page")) {
		q.setString("source", request.getOption("page").replace(' ', '_').toUpperCase());
	}
	
	if (Location.class.getName().equals(request.getObjectType())) {
		q.setString("roomType", Room.class.getName());
		q.setString("locType", NonUniversityLocation.class.getName());
	}

	return q.setString("type", request.getObjectType()).setLong("id", request.getObjectId()).setCacheable(true).list();
}
 
Example 17
Project: dhus-core   File: HibernateDao.java   Source Code and License Vote up 4 votes
/**
 * <p>Returns a List of <b>T</b> entities, where HQL clauses can be
 * specified.</p>
 * 
 * Note: This method is useful in read only. It can be use to delete or 
 * create <b>T</b> entities, but caution with <code>top</code> and 
 * <code>skip</code> arguments.
 * 
 * @param clauses query clauses (WHERE, ORDER BY, GROUP BY), if null no
 * clauses are apply.
 * @param skip number of entities to skip.
 * @param n  number of entities max returned.
 * @return a list of <b>T</b> entities.
 * @deprecated use of {@link #listCriteria(DetachedCriteria, int, int)}
 */
@Deprecated
@SuppressWarnings ("unchecked")
public List<T> scroll (final String clauses, final int skip, final int n)
{
   StringBuilder hql = new StringBuilder ();
   hql.append ("FROM ").append (entityClass.getName ());
   if (clauses != null)
      hql.append (" ").append (clauses);

   Session session;
   boolean newSession = false;
   try
   {
      session = getSessionFactory ().getCurrentSession ();
   }
   catch (HibernateException e)
   {
      session = getSessionFactory ().openSession ();
      newSession = true;
   }

   Query query = session.createQuery (hql.toString ());
   if (skip > 0) query.setFirstResult (skip);
   if (n > 0) 
   {
      query.setMaxResults (n);
      query.setFetchSize (n);
   }
   
   logger.info("Execution of HQL: " + hql.toString ());
   long start = System.currentTimeMillis ();

   List<T> result = (List<T>) query.list ();
   logger.info("HQL executed in " + 
      (System.currentTimeMillis() -start) + "ms.");

   if (newSession)
   {
      session.disconnect ();
   }

   return result;
}
 
Example 18
Project: DWSurvey   File: HibernateDao.java   Source Code and License Vote up 4 votes
/**
 * 设置分页参数到Query对象,辅助函数.
 */
protected Query setPageParameterToQuery(final Query q, final PageRequest pageRequest) {
	q.setFirstResult(pageRequest.getOffset());
	q.setMaxResults(pageRequest.getPageSize());
	return q;
}
 
Example 19
Project: ImageClassify   File: MarkService.java   Source Code and License Vote up 4 votes
@Override
public List<Image_Mark> getInterestComposition(int amount,int user_id,List<Integer> imgIds) {
	 List<Image_Mark> marks = new ArrayList<Image_Mark>();
	 Session session = HibernateUtils.getSession();//生成Session实例
	 Transaction tx = session.beginTransaction();//生成事务实例String
	 String listToString = "(";
	 for (int i = 0; i < imgIds.size()-1; i++) {
		 listToString += imgIds.get(i)+",";
	}
	 listToString += imgIds.get(imgIds.size()-1)+")";
	 
	 try {  
	    Query query = session.createSQLQuery("SELECT img_machine_tag_label,img_path,img_name,user_id,img_id FROM"
	    		+ " image_mark GROUP BY img_id HAVING img_id NOT IN(SELECT img_id FROM Mark WHERE user_id = "+user_id+" OR"
	    		+ " img_id IN "+listToString+") ORDER BY COUNT(*) ASC")
	    		.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);  
		    query.setFirstResult(0);
		    query.setMaxResults(amount);
	    marks = query.list();
	     //调用session的get()方法,找到此用户到内存中
	    tx.commit();//提交事务
	} catch (Exception e) {
		e.printStackTrace();
		tx.rollback();//事务回滚
	}finally{
		HibernateUtils.closeSession();//关闭session实例
	} 
	 List<Image_Mark> marks2 = new ArrayList<Image_Mark>();
	 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	 
	 for (int i = 0; i < marks.size(); i++) { 
		 Image_Mark image_Mark = new Image_Mark();
		  Map map = (Map) marks.get(i);
		  //img_machine_tag_label,img_path,img_name,user_id,img_id
		  image_Mark.setImg_id(map.get("img_id")+"");
		  image_Mark.setImg_machine_tag_label(map.get("img_machine_tag_label")+"");
		  image_Mark.setImg_name(map.get("img_name")+"");
		  image_Mark.setImg_path(map.get("img_path")+"");
		   marks2.add(image_Mark);
	 }  
	 return marks2;
}
 
Example 20
Project: ImageClassify   File: CompositionService.java   Source Code and License Vote up 4 votes
@Override
public List<UserRank> getRankListOfAll(int start, int num,String rankidentification) {
	 List<UserRank> userRanks = new ArrayList<UserRank>();
	 Session session = HibernateUtils.getSession();//生成Session实例
	 Transaction tx = session.beginTransaction();//生成事务实例 
	 String sqlOfIntegral = "SELECT username,sex,integral,AVG(mark_accuracy) AS accuracy,avatar_url FROM USER LEFT JOIN image_mark ON user.user_id = image_mark.user_id  GROUP BY USER.user_id ORDER BY integral DESC";
	 String sqlOfAccuracy = "SELECT username,sex,integral,AVG(mark_accuracy) AS accuracy,avatar_url FROM USER LEFT JOIN image_mark ON user.user_id = image_mark.user_id  GROUP BY USER.user_id ORDER BY accuracy DESC";
	 String sql = "";
	 if (rankidentification.equals(Constant.INTEGRAL)) {
			sql = sqlOfIntegral;
	 }else if (rankidentification.equals(Constant.ACCURACY)) {
		 	sql = sqlOfAccuracy;
	 }
	 try { 
		 Query query = session.createSQLQuery(sql); 
		 query.setFirstResult(start-1);
		 query.setMaxResults(num);
		 userRanks = query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list();
	     //调用session的get()方法,找到此用户到内存中
	    tx.commit();//提交事务
	} catch (Exception e) {
		e.printStackTrace();
		tx.rollback();//事务回滚
	}finally{
		HibernateUtils.closeSession();//关闭session实例
	}     
	 List<UserRank> userRanks2 = new ArrayList<UserRank>(); 
	 
	 for (int i = 0; i < userRanks.size(); i++) { 
		  UserRank userRank = new UserRank();
		  Map map = (Map) userRanks.get(i); 
		  userRank.setUsername(map.get("username")+""); 
		  userRank.setSex(map.get("sex")+"");
		  userRank.setIntegral(map.get("integral")+"");
		  userRank.setAvatar_url(map.get("avatar_url")+"");
		  userRank.setAccuracy(map.get("accuracy")+""); 
		  userRank.setAmount("");
		  userRanks2.add(userRank);
	 }  
	 return userRanks2;  
}