ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BWSO, Bernd Behler" ...@bwso.de>
Subject AW: tablename in resultmap column
Date Thu, 14 Aug 2008 13:08:09 GMT
Hi Jeff,

 

I am currently using MySQL JDBC connector 5.1.6  running against a MYSQL
5.0.45 server, but it should work with HSQLDB too.

If necessary, I can provide a test project for you to download.

 

For a quick test, simply take one of your mysql projects and only modify
the resultmap for any entity to include the tablename. You don't have to
change any of your sql statements for it to work.  Works for me with all
(i)abator generated statements and my own "*" statements. 

 

Looking at your sql statement below, you also use tablename inclusion in
your join:

 

> select product.*, category.*

> from product join category on  <http://product.id/> product.id =
<http://category.id/> category.id

 

You explicitly write "product.id" and "category.id" in your "on clause"
which isn't necessary, but needed if columns are ambiguous.

Please give it another try and tell me if it worked :-)

 

B. Behler

 

 

 

Von: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Gesendet: Mittwoch, 13. August 2008 21:52
An: user-java@ibatis.apache.org
Betreff: Re: tablename in resultmap column

 

What database are you using?  What you describe is some kind of auto
aliasing that I have not seen before.  For example, 

 

select product.*, category.*

from product join category on product.id <http://product.id/>  =
category.id <http://category.id/> 

 

should return ID, NAME, ID, NAME

 

NOT


PRODUCT.ID, PRODUCT.NAME, CATEGORY.ID, CATEGORY.NAME

 

I tried your syntax with both HSQLDB and MySQL and it didn't work.

 

Jeff Butler


Mime
View raw message