Cause: No type handler could be found to map the property 'reporter' to the colu
在做根据ID查询一个带有外键的主表类时,如果在映射文件方法里返回结果使用相应类,则会报此种错误:Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler could be found to map the property 'reporter' to the column 'reporter'. One or both of the types, or the combination of types is not supported.
解决办法:使用resultMap。
错误代码:
<select id="selectPetitonLetterById" parameterresultname="code"><resultMap id="PetitionLetterResult" column="id"/> <result property="identifier" column="identifier"/> <result property="reporter" column="reporter" select="selectReporter"/> <result property="letterInformation" column="letterInformation" select="selectLetterInformation"/> <result property="supervision" column="supervision" select="selectSupervision"/> <result property="processFlow" column="processFlow" select="selectProcessFlow"/> </resultMap><select id="selectPetitonLetterById" parameterresultMap="PetitionLetterResult">select * from t_petitionletter where id = #id# </select>