ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Rouillier <guyr-...@burntmail.com>
Subject Re: Composite key problems in column attribute (again)
Date Wed, 17 Mar 2010 04:09:13 GMT
You haven't specified the parameterType for the nested getDisabilityList 
select statement.  So, iBATIS defaults the best it can to type Object. 
You then try to set two properties on that Object, autoID and semester. 
  Object doesn't have such properties, hence the error message.

Specify an parameterType that has those two properties.

On 3/16/2010 7:12 PM, Hermit Geek wrote:
>
> I know this has been addressed before but it's still not working for me.
>
> I'm developing an application pro bono for the local community college. It
> was mostly working in Ibatis 2 and then when I migrated to 3, my composite
> keys would no longer work. I'm currently in Ibatis 3, beta 10. Below is a
> portion of my mapper file. The collection property works as expected with a
> single parameter (autoID) and a hard coded second parameter for the
> composite key as indicated below in the resultMap.
>
> <resultMap id="dsrcStudentResult"    type="studentData">
>          <id property="autoID"                 column="autoid" />
>          <result property="activeSemester"    column="activeSemester"/>
>          <result property="studentID"        column="studentID"/>
>          <result property="lastName"            column="lastname"/>
>          <result property="firstName"        column="firstname"/>
>          ...
>
>          <collection property="disabilityList" javaType="ArrayList"
> ofType="String"
>              column="autoID" select="getDisabilityList" />
>
>      </resultMap>
>
>
>       <select id="getDisabilityList"  resultType="java.lang.String">
>          SELECT specificdisabilityfkey
>               FROM joinDsrcStudentDisability
>               WHERE joinDsrcStudentDisability.dsrcStudentFKey = #{id}
>               AND semesterFKey = '20081'
>
>       </select>
>
>      <select id="getStudentByAutoID" parameterType="studentQueryParam"
> resultMap="dsrcStudentResult">
>          SELECT *, #{activeSemester} AS activeSemester
>          FROM dsrcStudent
>          WHERE dsrcStudent.autoID = #{autoID}
>       </select>
>
> I changed the column attribute to accommodate composite keys and substitute
> the hard coded semesterFKey parameter with #{semester}
>
>          column="{autoID=id,activeSemester=semester}"
>
>          SELECT specificdisabilityfkey
>               FROM joinDsrcStudentDisability
>               WHERE joinDsrcStudentDisability.dsrcStudentFKey = #{id}
>               AND semesterFKey = #{semester}
>
> When the program executes, I get the following error:
>
> ### Error querying database.  Cause:
> org.apache.ibatis.reflection.ReflectionException: There is no setter for
> property named 'autoID' in 'class java.lang.Object'
> ### The error may involve dsrcdata.getStudentByAutoID-Inline
> ### The error occurred while setting parameters
>
> Am I doing something wrong, or should I wait for a later release?
> Thanks for the help,
> James Templer


-- 
Guy Rouillier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message