Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用JDBCTemplate创建映射列表_Java_Spring_Oracle_Jdbctemplate - Fatal编程技术网

Java 使用JDBCTemplate创建映射列表

Java 使用JDBCTemplate创建映射列表,java,spring,oracle,jdbctemplate,Java,Spring,Oracle,Jdbctemplate,我想使用SpringJDBCTemplate运行这个查询 String sql = "select domain_item_value from domain_item where domain_item_id = 6 and domain_item_id = 9"; List<Map<String, Object>> odTypeMap = template.query(valQ, new SingleColumnRowMapper<Map<

我想使用SpringJDBCTemplate运行这个查询

    String sql = "select domain_item_value from domain_item where domain_item_id = 6 and domain_item_id = 9";
    List<Map<String, Object>> odTypeMap = template.query(valQ,  new SingleColumnRowMapper<Map<String, Object>>());

运行template.query方法时,我做错了什么?

我认为您对工作原理的理解是错误的。泛型类型与您试图表示的列的映射类型相关联

通过将映射作为类型传递,您可能会混淆它

请看一看示例用法和比较

DOMAIN_ITEM_ID->6
DOMAIN_ITEM_VALUE->CURRENT

DOMAIN_ITEM_ID->9
DOMAIN_ITEM_VALUE->AGED