ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todorovich, Milo" <Milo_Todorov...@pamperedchef.com>
Subject RE: parameterClass for select from resultMap with composite keys
Date Mon, 14 May 2007 16:29:01 GMT
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. 


Mime
View raw message