commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Aymé (JIRA) <>
Subject [jira] Updated: (DBUTILS-34) BasicRowProcessor loses any information on database field case
Date Fri, 11 May 2007 15:41:15 GMT


Julien Aymé updated DBUTILS-34:


Hello, I had the same problem as yours, and I fixed it with an implementation of my own of
the CaseInsensitiveHashMap:

Instead of converting the key to lower case before putting it into the map, I chose to keep
the key as it was given, and maintain an internal mapping from lower case keys to real keys.

I join the whole BasicRowProcessor class, and the patch. (Some of the comments can be removed,
it's just for the clarity of the code).

> BasicRowProcessor loses any information on database field case
> --------------------------------------------------------------
>                 Key: DBUTILS-34
>                 URL:
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.0
>            Reporter: Fabio Insaccanebbia
>            Priority: Minor
>         Attachments:, BasicRowProcessor.patch
> In the BasicRowProcessor class there is a comment about the toMap method:
> " This  implementation returns a <code>Map</code> with case insensitive column
names as keys.  Calls to map.get("COL") and map.get("col") return the same value"
> So the "contract" of this method just says that the "get" method is case insensitive.
The current implementation obtains this result by putting all the keys in lowercase. This
way we simply "lose" every information about the case of the fields. If you call the "keys"
iterator, you don't have anymore the keys you inserted, but the "lowercase" version. 
> I find it not completely correct: I would expect the keys to be exactly the ones I set
on the database, also if I can get the value in a case insensitive way.
> I still have to find the idea for a pathc, but I'd like to know if you find my reasoning
> I consider the current behaviour a problem, since I had to map the database fields to
a bean and the "case" made it impossible, even if I had set my database to return mixed case

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message