我有一个问题
HashMap<String, List<AppPrjMilestone>> dateMilestoneMap
= new HashMap<String, List<AppPrjMilestone>>();
Run Code Online (Sandbox Code Playgroud)
我将动态键放在Hashmap对象中,如下所示:
dateMilestoneMap.put(""+crateDate,value);
Run Code Online (Sandbox Code Playgroud)
最后我得到这样的结果:
("28/01/2012",value)
("01/01/2012",value)
("26/01/2012",value)
Run Code Online (Sandbox Code Playgroud)
我希望以desc或asc顺序返回键值对.我怎样才能做到这一点?
所以现在我有一个包含一段看起来像这样的代码的程序......
Criteria crit = session.createCriteria(Product.class);
ProjectionList projList = Projections.projectionList();
projList.add(Projections.max("price"));
projList.add(Projections.min("price"));
projList.add(Projections.countDistinct("description"));
crit.setProjection(projList);
List results = crit.list();
Run Code Online (Sandbox Code Playgroud)
我想迭代结果.所以提前感谢您提供的任何帮助/建议.
这是我的代码:
List<Long> ids= new ArrayList<Long>();
ids.add(10L);ids.add(11L);
String queryString ="select type_id from Types where parent_type_id in (:typeIds)";
SQLQuery sqlQuery = session.createSQLQuery(queryString);
sqlQuery.setParameter("typeIds", ids);
List<Object[]> results = sqlQuery.list();
Run Code Online (Sandbox Code Playgroud)
我在执行上述查询时收到此错误.仅供参考,当我将数组或ArrayList作为参数传递时,我刚刚看到了这个问题.
ERROR util.JDBCExceptionReporter: ERROR: operator does not exist:
bigint = bytea Exception in thread "main"
org.hibernate.exception.SQLGrammarException: could not execute query
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
Run Code Online (Sandbox Code Playgroud) 我有一个像这样的json对象.
{'01/19/2012': Array[1],'02/19/2012': Array[7],'03/19/2012': Array[6]}
Run Code Online (Sandbox Code Playgroud)
现在我想迭代这张地图
我需要结果
Date : 01/19/2012
Array Data here
Date : 02/19/2012
Array Data here
Run Code Online (Sandbox Code Playgroud)
谢谢!!