Results 1 to 4 of 4

Thread: queryForList issue..is it case-sensitive?

  1. #1
    Join Date
    Jul 2006
    Posts
    19

    Default queryForList issue..is it case-sensitive?

    Hi All,

    I am facing strange issue with queryForList API.
    String sql="select name from emp where empId=10";
    List list = queryForList(sql);
    Iterator itr= list.iterator();
    if(itr.hasNext()){
    map = (Map)itr.next();
    LOG.info("name:" + map.get("name"));
    }

    Now this works as long as I deploy my application as WAR on webserver. But it stops working when I deploy it as packaged EAR.

    When packaged as EAR
    - map.get("name") returns null. But it works when i use uppercase.....i.e.
    map.get("NAME")

    When packaged as WAR
    - it works for map.get("name") and map.get("NAME") also.

    How come? whats the issue? Isnt it case -sensitive? is there any way to make it case-insensitive.

    Thanks,
    Shriram

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    wondered about this

    why you have this?
    map = (Map)itr.next();
    LOG.info("name:" + map.get("name"));
    nothing related directly with the db

    tell me, the variable map how is declared ?

    regards
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Jul 2006
    Posts
    19

    Default

    Map map =null;

    This is how map variable is declared.

    queryForList method return results will be mapped to a List (one entry for each row) of Maps (one entry for each column using the column name as the key). Each element in the list will be of the form returned by this interface's queryForMap() methods.

    I read somewhere that to make retrival from map case-insensitive we need to use commons-collections-3.2.jar instead of commons-collections-2.1.1.jar

    is it true? whats the rational behind it?

    - Anirudha

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    This all sounds very strange! Is it possible to see the code you are running?
    Last edited by karldmoore; Aug 29th, 2007 at 12:08 PM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

Posting Permissions

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