开发者

How to use the SimpleJdbcTemplate queryForMap

开发者 https://www.devze.com 2023-02-03 23:11 出处:网络
Is there a way to get a Map<String,Integer> for instance? The call seems to return only a Map<String, Object> which I can\'t开发者_JAVA技巧 cast to Map<String,Integer>. I usually use

Is there a way to get a Map<String,Integer> for instance? The call seems to return only a Map<String, Object> which I can't开发者_JAVA技巧 cast to Map<String,Integer>.


I usually use it like this:

Map result = simpleJdbcTemplate.queryForMap(
 "SELECT COUNT(*) AS intRecords " +
 "FROM tblUsers",
 new Object[]);

Integer users = result.get("intRecords");

Does that help you?

0

精彩评论

暂无评论...
验证码 换一张
取 消