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 Frantisek Rezac <Fr...@profinit.eu> on 2009/01/13 14:19:29 UTC

How to resolve same column/property name when reusing resultMap continued

Hi,
I'm writing just to verify that there is no other way to solve problem 
from this thread:
http://www.mail-archive.com/user-java@ibatis.apache.org/msg07715.html

solution proposed here is not working when there is more than one foreign 
key to the same second table - I simply have to copypaste the result map 
for the second foreign key. Am I right?
František Řezáč
Consultant

Profinit, s.r.o. | Člen skupiny NFH
Tychonova 2 | 160 00 Praha 6
Mobil: +420 725 817 361 | Tel: +420 224 316 016
Email: frantisek.rezac@profinit.eu
Více o nás: www.profinit.eu



Re: How to resolve same column/property name when reusing resultMap continued

Posted by Jeff Butler <je...@gmail.com>.
I know of these options for dealing with duplicate column names:

1. Alias the columns so the names are unique.  Note that this is not
an iBATIS problem - this is they way JDBC works.  This is the best
solution IMHO.
2. Don't alias the column names and use column indexes in your result
mappings.  This works, but is hard to maintain and you have to be very
careful that the indexes match up and stay the same.
3. If you are using MySQL, then you can append the table name to the
column name in the result mapping to deal with duplicate column names.
 As far as I know, MySQL is the only database that supports this.

Jeff Butler


2009/1/13 Frantisek Rezac <Fr...@profinit.eu>:
>
> Hi,
> I'm writing just to verify that there is no other way to solve problem from
> this thread:
> http://www.mail-archive.com/user-java@ibatis.apache.org/msg07715.html
>
> solution proposed here is not working when there is more than one foreign
> key to the same second table - I simply have to copypaste the result map for
> the second foreign key. Am I right?
> František Řezáč
> Consultant
>
> Profinit, s.r.o. | Člen skupiny NFH
> Tychonova 2 | 160 00 Praha 6
> Mobil: +420 725 817 361 | Tel: +420 224 316 016
> Email: frantisek.rezac@profinit.eu
> Více o nás: www.profinit.eu
>
>
>