<select id="getCompanyTypeByIdAndLocale"
           resultMap="select-company-type-result">
            select ct.company_type_id

                 , ct.name

                 , ct.is_active

                 , ct.create_time

                 , ct.creator_id

                 , ct.update_time

                 , ct.updater_id

              from company_type ct

               where ct.locale_id = #localeId#

               and ct.company_type_id = #lookupId#
</select>

 

 


From: Todorovich, Milo [mailto:Milo_Todorovich@pamperedchef.com]
Sent: Monday, May 14, 2007 12:29 PM
To: user-java@ibatis.apache.org
Subject: RE: parameterClass for select from resultMap with composite keys

 

Can you post the complete SQL that you used in the statement:

 

<select id="getCompanyTypeByIdAndLocale"
           resultMap="select-company-type-result">
  select …
</select>

 

 

 


From: Darren Moen [mailto:Darren@theladders.com]
Sent: Monday, May 14, 2007 11:15 AM
To: user-java@ibatis.apache.org
Subject: RE: parameterClass for select from resultMap with composite keys

Been a while and haven’t had a response on this. My workaround is below, basically duplicate selects, one that gets called from the resultMap and one that gets called from the DAO; exact same except for the parameterClass.

Does anyone have a better way to this? I’d rather not have double the number of selects!

 

1. Select called from resultMap with composite keys

 

<select id="getCompanyTypeByIdAndLocale"
           resultMap="select-company-type-result">
  select …
</select>

 

2. Select called from DAO, with Map as parameterClass

 

<select id="getCompanyTypeByIdAndLocale2"

           parameterClass=”java.util.Map”
           resultMap="select-company-type-result">
  select …
</select>

 

Thanks,

Darren


From: Darren Moen [mailto:Darren@theladders.com]
Sent: Wednesday, April 18, 2007 12:30 AM
To: user-java@ibatis.apache.org
Subject: parameterClass for select from resultMap with composite keys

 

 

I have a result map that does a result select based on 2 columns

<result property="companyType"
           column="lookupId=company_type_id,localeId=locale_id"
           select="getCompanyTypeByIdAndLocale"/>

The select works fine when done from the result map when NO parameterClass is specified

<select id="getCompanyTypeByIdAndLocale"
           resultMap="select-company-type-result">
  select …
</select>

But then I can’t reuse that select statement from my DAO because it needs 2 parameters, but if I pass in a map it complains because it was expecting a String (because no paramaterClass was specified)

If I specify a parameterClass=’java.util.Map’ I get a error:
--- Check the result mapping for the 'companyType' property.
--- Cause: java.sql.SQLException: Column 'lookupId=company_type_id,localeId=locale_id' not found.


I know I could easily have 2 select statements, but hopefully that’s not necessary.
Any help would be appreciated.