private static <T> List<Order> getOrders(CriteriaBuilder cb, Root<T> root,
			Map<String, OR> sort) {
		List<Order> orders = new ArrayList<Order>();
		if (sort != null) {
			for (String field : sort.keySet()) {
				OR way = sort.get(field);
				try {
					Order or = null;

					/**
					 * separate field and function
					 */
					String[] splitedfield = field.split(",");
					Path<String> path = getPath(root, splitedfield[0]);
					if (path != null) {
						Expression<?> p = path;
						if (splitedfield.length == 2) {
							Expression<?> expr = getExpressionPathAndFunctions(
									cb, path, splitedfield[0], splitedfield[1]);
							if (expr != null) {
								p = expr;
							}
						}
						or = (way.equals(OR.ASC)) ? cb.asc(p) : cb.desc(p);
						orders.add(or);
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return orders;
		}
		return null;
	}