組態檔時這樣:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.njpji.my.dao.UserCourseDao">
<!-- 映射結果集 -->
<resultMap type="UserCourse" id="userCourseMap">
<!-- id -->
<id property="id" column="id"/>
<!-- stuCount -->
<result property="stuCount" column="scount"/>
<!-- Course -->
<association property="course" javaType="Course">
<result column="cname" property="c_name"/>
<result column="chour" property="c_hour"/>
</association>
<!-- Time -->
<association property="time" javaType="Time">
<result column="ttime" property="time"/>
</association>
<!-- Semester -->
<association property="semester" javaType="Semester">
<result column="stime" property="time"/>
</association>
<!-- Theory_G -->
<association property="tg" javaType="Theory_G">
<result column="v2" property="valuation"/>
</association>
<!-- Theory_J -->
<association property="tj" javaType="Theory_J">
<result column="v1" property="valuation"/>
</association>
<!-- Theory_repeat -->
<association property="tr" javaType="Theory_repeat">
<result column="v3" property="valuation"/>
</association>
<!-- Classes -->
<collection property="classes" javaType="Classes">
<result property="name" column="name"/>
</collection>
</resultMap>
<!-- 授課資訊 -->
<select id="queryUserCourse" resultMap="userCourseMap">
select uc.id id,cs.c_name cname,c.name name,tj.valuation v1,uc.stuCount scount,tg.valuation v2,cs.c_hour chour,tr.valuation v3,s.time stime,t.time ttime
from tb_user_course uc,tb_class c,tb_coursetype ct,tb_semester s,tb_theory_g tg,tb_theory_j tj,tb_time t,tb_course cs,tb_theory_repeat tr
where uc.classid=c.id
and ct.id=uc.coursetype_id
and s.id=uc.semesterid
and tg.id=uc.G_id
and tj.id=uc.j_id
and uc.timeid=t.id
and uc.courseid=cs.id
and uc.tr_id=tr.id
and uc.userid=#{userid}
order by uc.id
limit #{pagestart},8;
</select>
</mapper>
UserCourse屬性如下:
private int id;
private Course course;
private Time time;
private Semester semester;
private ArrayList<Classes> classes;
private Theory_G tg;
private Theory_J tj;
private int stuCount;
private Theory_repeat tr;
但是運行測驗的時候卻出現了:
嚴重: Servlet.service() for servlet [dispatcher] in context with path [/teacher-workload] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'classes' of 'class cn.njpji.my.pojo.UserCourse' with value 'Classes [id=0, name=計科01班]' Cause: java.lang.IllegalArgumentException: argument type mismatch] with root cause
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.ibatis.reflection.invoker.MethodInvoker.invoke(MethodInvoker.java:41)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:180)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.set(BeanWrapper.java:59)
at org.apache.ibatis.reflection.MetaObject.setValue(MetaObject.java:140)
求助各位靚仔靚女....
uj5u.com熱心網友回復:
UserCourse 類的classes屬性設定的有問題uj5u.com熱心網友回復:
啥問題?
我覺得挺好的
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/157258.html
標籤:Java EE
上一篇:idea無法解決的問題
下一篇:BAT批處理實作休眠關機重啟
