Announcement Announcement Module
Collapse
No announcement yet.
JDBCTemplate QueryForList returns wrong value Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JDBCTemplate QueryForList returns wrong value

    Hi all,

    I have the following code...

    Code:
    String GET_AGENTS_FOR_CYCLE = "select AGENTSURROGATECODE from SETTLEMENT.AGENT_DETAILS where CYCLE = ?";
    List agentsList = jdbcTemplate.queryForList(GET_AGENTS_FOR_CYCLE,
    				new Object [] {getCycle()});
    Iterator agentItr = agentsList.iterator();
    while (agentItr.hasNext())
    		{
    			String agentCode = (String) agentItr.next();
    Right now this is failing with the exception...

    Code:
    java.lang.ClassCastException: org.springframework.util.LinkedCaseInsensitiveMap cannot be cast to java.lang.String
    	at com.wu.interstream.advising.loaders.AgentsRetriever.execute(AgentsRetriever.java:54)
    So it looks like AgentList is made up of LinkedCaseInsensitiveMap objects instead of String objects. Why is this?

    Thanks in advance for any help.

  • #2
    Have you actually taken the time to look at the method signatures and return type.... The method you are using return a list of maps... If you want it to return a list of string you have to use another method (one that takes a type argument).

    Comment

    Working...
    X