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
--
View this message in context:
http://old.nabble.com/Composite-key-problems-in-column-attribute-%28again%29-tp27925843p27925843.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]