测试程序片段如下: ApplicationContext context = new FileSystemXmlApplicationContext("beans-config.xml");
DataSource ds = (DataSource)context.getBean("dataSource");
JdbcTemplate jt = new JdbcTemplate(ds);
List list = jt.queryForList("select fname,lname from employee");
java.util.Iterator<HashMap> it = list.iterator();
while(it.hasNext()){
HashMap map = it.next();
System.out.println((String)map.get("fname")+(String)map.get("fname"));
}
编译正常通过,执行的时候发现错误(貌似一定要用apache集合包?)
错误信息如下:
Exception in thread "main" java.lang.ClassCastException: org.apache.commons.collections.map.ListOrderedMap不解特来此请教达人,希望知道的各位兄弟 不吝指教.