Results 1 to 2 of 2

Thread: JDBCTemplate QueryForList returns wrong value

  1. #1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    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).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •