@SuppressWarnings("unchecked")
	public Query createSQLQuery(String hsql, Map<String, Object> params) {
		// 取得当前查询总记录数
		Query q = this.getSession().createSQLQuery(
				hsql);

		String[] keys = q.getNamedParameters();
		if (keys != null && params != null) {
			for (String key : keys) {
				if (!params.containsKey(key)) {
					throw new RuntimeException("没有设置参数" + key + "的值");
				}
				Object value = params.get(key);
				int flg = getParameterType(value);
				switch (flg) {
				case 0:
					q.setParameter(key, value);
					break;
				case 1:
					q.setParameterList(key, (Collection) value);
					break;
				case 2:
					q.setParameterList(key, (Object[]) value);
					break;
				}
			}
		}
		return q;
	}