Closed GoogleCodeExporter closed 9 years ago
Mybatis(mybatis-spring-1.0.3-SNAPSHOT mybatis-3.0.6) configuration like this: <select id="getBoardByID" parameterType="long" resultMap="boardMap"> select board.ID, board.ParentID, board.ParentIDs, board.ChildIDs, board.BoardName, board.Explains, board.Bulletin, board.BoardPic, board.UseStat, board.Orders, board.NeedPasswd, board.Passwd, board.BoardLevel, board.BoardType, board.AllowHTML, board.AllowUBB, board.AuditPost, board.AuditAttach, board.AddUserPostNum, board.IsHidden, board.IsAuth, board.MainPostNum, board.PostNum, boardmaster.ID, boardmaster.UserName, boardmaster.RoleID, boardmaster.OverChildPurview, boardmaster.IsHidden, boardmaster.BoardID, boardtag.boardID, boardtag.ID, boardtag.ID, boardtag.TagName, boardtag.Orders, boardtag.BoardID from bbscs_board board left outer join bbscs_boardmaster boardmaster on board.ID = boardmaster.boardID left outer join bbscs_boardtag boardtag on board.ID = boardtag.boardID where board.ID = #{id} order by boardtag.orders asc </select> <resultMap type="org.jep.model.Board" id="boardMap"> <id property="id" column="id" /> <result property="parentID" column="parentID" /> <result property="parentIDs" column="parentIDs" /> <result property="childIDs" column="childIDs" /> <result property="boardName" column="boardName" /> <result property="explains" column="explains" /> <result property="bulletin" column="bulletin" /> <result property="passwd" column="passwd" /> <result property="boardLevel" column="boardLevel" /> <result property="boardType" column="boardType" /> <result property="allowHTML" column="allowHTML" /> <result property="allowUBB" column="allowUBB" /> <result property="auditPost" column="auditPost" /> <result property="auditAttach" column="auditAttach" /> <result property="addUserPostNum" column="addUserPostNum" /> <result property="isHidden" column="isHidden" /> <result property="isAuth" column="isAuth" /> <result property="mainPostNum" column="mainPostNum" /> <result property="postNum" column="postNum" /> <collection property="boardMaster" column="boardID" ofType="org.jep.model.BoardMaster" javaType="hashmap"> <id column="id" property="id"/> <result column="userName" property="userName"/> <result property="roleID" column="roleID" /> <result property="overChildPurview" column="overChildPurview" /> <result property="isHidden" column="isHidden" /> <result property="boardId" column="boardId" /> </collection> <collection property="boardTag" column="boardID" ofType="org.jep.model.BoardTag"> <result property="tagName" column="tagName" /> <result property="orders" column="orders" /> <result property="boardID" column="boardID" /> </collection> </resultMap> Then,I tested the code in jUnit and the error message like these: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error getting nested result map values for 'boardMaster'. Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'boardMaster' of 'org.jep.model.Board@10e98d8' with value 'org.jep.model.BoardMaster@154b574' Cause: java.lang.IllegalArgumentException: argument type mismatch at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBat isExceptionTranslator.java: 73) at org.mybatis.spring.SqlSessionTemplate $SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358) at $Proxy15.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java: 155) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java: 75) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:25) at $Proxy19.getBoardByID(Unknown Source) at org.jep.service.impl.BoardServiceCacheImp.getBoardByID(BoardServiceCacheImp.java : 103) So,what's the reason?Can you give me some advice?Thank you.
Original issue reported on code.google.com by Jiang.En...@gmail.com on 13 Dec 2011 at 2:55
Jiang.En...@gmail.com
You should not use javaType on a collection element. http://www.mybatis.org/core/sqlmap-xml.html
Original comment by eduardo.macarron on 27 Jan 2012 at 5:55
eduardo.macarron
Original issue reported on code.google.com by
Jiang.En...@gmail.com
on 13 Dec 2011 at 2:55