You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Rajaram, Naresh" <Na...@fairisaac.com> on 2008/09/22 08:31:48 UTC

Ordering of the columns

Hi All,

 

When I use resultClass="java.util.HashMap", I was under the impression
that, in what order the SQL Query returned values, the same way it will
be stored inside the HashMap.

 

But to my surprise, the ordering inside the HashMap is completely
different from the resultset column ordering. Why is that?

 

Is there any way through which I can mention that, the ordering have to
be consistent with the database columns?

 

Please help me.

 

Thanks

Naresh

 


This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.


Re: Ordering of the columns

Posted by Fidel Viegas <fi...@gmail.com>.
On Mon, Sep 22, 2008 at 8:27 AM, Rajaram, Naresh
<Na...@fairisaac.com> wrote:
> Hi All,
>
>
>
> My problem got solved. I am using LinkedHashMap instead of HashMap.
>
>
>
> Will this be an issue?

Hi Naresh,

This is really a java issue. HashMaps do not do partial sorts. If that
is what you want, you really need to use a List, which is what you
have done.

You sorted your problem, anyway.

All the best,

Fidel.

RE: Ordering of the columns

Posted by "Rajaram, Naresh" <Na...@fairisaac.com>.
Hi All,

 

My problem got solved. I am using LinkedHashMap instead of HashMap.

 

Will this be an issue?

 

Thanks

Naresh

 

________________________________

From: Rajaram, Naresh [mailto:NareshRajaram@fairisaac.com] 
Sent: Monday, September 22, 2008 12:02 PM
To: user-java@ibatis.apache.org
Subject: Ordering of the columns

 

Hi All,

 

When I use resultClass="java.util.HashMap", I was under the impression
that, in what order the SQL Query returned values, the same way it will
be stored inside the HashMap.

 

But to my surprise, the ordering inside the HashMap is completely
different from the resultset column ordering. Why is that?

 

Is there any way through which I can mention that, the ordering have to
be consistent with the database columns?

 

Please help me.

 

Thanks

Naresh

 

This email and any files transmitted with it are confidential,
proprietary
and intended solely for the individual or entity to whom they are
addressed.
If you have received this email in error please delete it immediately.

This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.