@Override
	public int viewProfile(int requesterID, int profileOwnerID,
			HashMap<String, ByteIterator> result, boolean insertImage, boolean testMode) {
		
		if (requesterID < 0 || profileOwnerID < 0)
			return -1;

		try {
			tx = session.beginTransaction();
			USERS u = (USERS)session.get(USERS.class, Integer.toString(profileOwnerID));
			
			result.put("friendcount", new ObjectByteIterator(Integer.toString(u.getConfFriendCnt()).getBytes()));
			result.put("resourcecount", new ObjectByteIterator(Integer.toString(u.getResCnt()).getBytes()));
			if(profileOwnerID == requesterID)
				result.put("pendingcount", new ObjectByteIterator(Integer.toString(u.getPendFriendCnt()).getBytes()));

			Map<String, Method> methods = FactoryInsert.getGetterMethods(USERS.class);
			Set<String> keys = methods.keySet();
			keys.remove("confFriendCnt");
			keys.remove("pendFriendCnt");
			keys.remove("resCnt");

			Iterator<String> it = keys.iterator();
			while(it.hasNext()){
				String key = it.next();
				if(!insertImage && (key.equalsIgnoreCase("pic") || key.equalsIgnoreCase("tpic")))
					continue;
				Method methd = methods.get(key);
				Object r = methd.invoke(u, null);
				result.put(key, new ObjectByteIterator(r.toString().getBytes()));											
			}
			tx.commit();
			return 0;
		} catch (Exception e) {
			System.out.println(e.toString());
			return -1;
		}
		finally{
//			session.close();
		}
	}