Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8329825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:55:24+00:00 2026-06-09T01:55:24+00:00

we using mybatis 3.1.1. we found for oracle the result map returned contains column

  • 0

we using mybatis 3.1.1.

we found for oracle the result map returned contains column name in Capital letters and in case of mySql the result map returned contains column name in small letters.

My question is : Is there is any way i can to write some sort of interceptor so that i can modify the result returned by result map.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:55:26+00:00Added an answer on June 9, 2026 at 1:55 am

    I’m afraid the answer is that MyBatis doesn’t provide any direct way to control the case of the keys in a result map. I asked this question recently on the MyBatis Google Group: https://groups.google.com/forum/?fromgroups#!topic/mybatis-user/tETs_JiugNE

    The outcome is dependent on the behavior of the JBDC driver.

    It also turns out that doing column aliasing as suggested by @jddsantaella doesn’t work in all cases. I’ve tested MyBatis-3.1.1 with three databases in the past: MySQL, PostgreSQL and H2 and got different answers. With MySQL, the case of the column alias does dictate the case of the key in the hashmap. But with PostgreSQL it is always lowercase and with H2, it is always uppercase. I didn’t test whether column aliases will work with Oracle, but by default it appears to return capital letters.

    I see two options:

    Option 1: Create some helper method that your code will always use to pull the data out of the returned map. For example:

    private Object getFromMap(Map<String, Object> map, String key) {
      if (map.containsKey(key.toLowerCase())) {
        return map.get(key.toLowerCase());
      } else {
        return map.get(key.toUpperCase());
      }
    }
    

    Option 2: Write a LowerCaseMap class that extends from java.util.AbstractMap or java.util.HashMap and wrappers all calls to put, putAll and/or get to always be lower case. Then specify that MyBatis should use your specific LowerCaseMap rather than a standard HashMap, when populating the data from the query.

    If you like this idea and want help on how to tell MyBatis how to use a different concrete collection class, see my answer to this StackOverflow question: https://stackoverflow.com/a/11596014/871012

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using mybatis to retrieve data from DB, the data returned is containing
I am using Oracle/MyBatis and trying to debug a stored procedure with an enormous
I am trying to test out Mybatis's user manual with the result map section.
First the problem: I'm using XML-defined queries and the SQL contains database name as
I am using MyBatis with Spring Integration as described here . I am further
I need to get the list of columns in a table using mybatis/ibatis in
I want to build an application using Hibernate and MyBatis integrate with Spring. In
I'm using MyBatis on Spring 3. Now I'm trying to execute two following queries
(Using MyBatis v3.0.4.) I have a problem that I do not know how to
What is the correct way to define collection implementation using MyBatis. Consider example below.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.