第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

mybatis 多對(duì)多 在collection中使用select查詢報(bào)錯(cuò)。。求解

mybatis 多對(duì)多 在collection中使用select查詢報(bào)錯(cuò)。。求解

慕粉4241372 2017-08-23 10:09:04
website類public?class?Website?{ ????private?Integer?id; ????private?String?name; ????private?String?websiteAddress; ????private?List<Category>?categoryList; ????private?List<Score>?scoreList; ????public?Website()?{ ????????super(); ????} ????public?Integer?getId()?{ ????????return?id; ????} ????public?void?setId(Integer?id)?{ ????????this.id?=?id; ????} ????public?String?getName()?{ ????????return?name; ????} ????public?void?setName(String?name)?{ ????????this.name?=?name?==?null???null?:?name.trim(); ????} ????public?String?getWebsiteAddress()?{ ????????return?websiteAddress; ????} ????public?void?setWebsiteAddress(String?websiteAddress)?{ ????????this.websiteAddress?=?websiteAddress?==?null???null?:?websiteAddress.trim(); ????} ????public?List<Category>?getCategoryList()?{ ????????return?categoryList; ????} ????public?void?setCategoryList(List<Category>?categoryList)?{ ????????this.categoryList?=?categoryList; ????} ????public?List<Score>?getScoreList()?{ ????????return?scoreList; ????} ????public?void?setScoreList(List<Score>?scoreList)?{ ????????this.scoreList?=?scoreList; ????} }category類public?class?Category?{ ????private?Integer?id; ????private?String?name; ????private?Integer?parentCategoryId; ????private?List<User>?userList; ????private?List<Website>?websiteList; ???? ????public?Integer?getId()?{ ????????return?id; ????} ????public?Category()?{ ????????super(); ????} ????public?void?setId(Integer?id)?{ ????????this.id?=?id; ????} ????public?String?getName()?{ ????????return?name; ????} ????public?void?setName(String?name)?{ ????????this.name?=?name?==?null???null?:?name.trim(); ????} ????public?Integer?getParentCategoryId()?{ ????????return?parentCategoryId; ????} ????public?void?setParentCategoryId(Integer?parentCategoryId)?{ ????????this.parentCategoryId?=?parentCategoryId; ????} ????public?List<User>?getUserList()?{ ????????return?userList; ????} ????public?void?setUserList(List<User>?userList)?{ ????????this.userList?=?userList; ????} ????public?List<Website>?getWebsiteList()?{ ????????return?websiteList; ????} ????public?void?setWebsiteList(List<Website>?websiteList)?{ ????????this.websiteList?=?websiteList; ????} }中間類public?class?WebsiteToCategory?{ ????private?Integer?websiteId; ????private?Integer?categoryId; ????public?WebsiteToCategory()?{ ????????super(); ????} ???? ????public?Integer?getWebsiteId()?{ ????????return?websiteId; ????} ????public?void?setWebsiteId(Integer?websiteId)?{ ????????this.websiteId?=?websiteId; ????} ????public?Integer?getCategoryId()?{ ????????return?categoryId; ????} ????public?void?setCategoryId(Integer?categoryId)?{ ????????this.categoryId?=?categoryId; ????} }websitemapper:?<resultMap?id="BaseResultMap"?type="com.wechat.bean.score.Website"> ??????<id?column="id"?jdbcType="INTEGER"?property="id"/> ??????<result?column="name"?jdbcType="VARCHAR"?property="name"/> ??????<result?column="website_address"?jdbcType="VARCHAR"?property="websiteAddress"/> ??????<collection?property="categoryList"?column="{website_id=id}" ??????????????????select="com.wechat.dao.WebsiteToCategoryMapper.selectCategoryByWebsiteId"/> ??</resultMap> ??<select?id="selectByPrimaryKey"?parameterType="java.lang.Integer"?resultMap="BaseResultMap"> ??select?* ??from?website ??where?id?=?#{id,jdbcType=INTEGER} </select>categorymapper:<resultMap?id="BaseResultMap"?type="com.wechat.bean.score.Category"> ????<id?column="id"?jdbcType="INTEGER"?property="id"?/> ????<result?column="name"?jdbcType="VARCHAR"?property="name"?/> ????<result?column="parent_category_id"?jdbcType="INTEGER"?property="parentCategoryId"?/> ????<collection?property="websiteList"?ofType="com.wechat.bean.score.Website"?column="category_id"?select="com.wechat.dao.WebsiteToCategoryMapper.selectWebsiteByCategoryId"?/> ??</resultMap> ??<select?id="selectByPrimaryKey"?parameterType="java.lang.Integer"?resultMap="BaseResultMap"> ????select?* ????from?category ????where?id?=?#{id,jdbcType=INTEGER} ??</select> </mapper>中間類mapper:<!--根據(jù)網(wǎng)站id查分類--> <resultMap?id="BaseResultMap1"?type="com.wechat.bean.score.Category"> ??<id?column="id"?jdbcType="INTEGER"?property="id"?/> ??<result?column="name"?jdbcType="VARCHAR"?property="name"?/> ??<result?column="parent_category_id"?jdbcType="INTEGER"?property="parentCategoryId"?/> </resultMap> <select?id="selectCategoryByWebsiteId"?parameterType="Integer"?resultMap="BaseResultMap1"> ??SELECT?c.*?FROM?category?c,website_to_category?wc?WHERE?c.id=wc.category_id?and?wc.website_id=#{website_id} </select> <!--根據(jù)分類id查網(wǎng)站--> <resultMap?id="BaseResultMap2"?type="com.wechat.bean.score.Website"> ??<id?column="id"?jdbcType="INTEGER"?property="id"/> ??<result?column="name"?jdbcType="VARCHAR"?property="name"?/> ??<result?column="website_address"?jdbcType="VARCHAR"?property="websiteAddress"?/> </resultMap> <select?id="selectWebsiteByCategoryId"?parameterType="Integer"?resultMap="BaseResultMap2"> ??SELECT?w.*?FROM?website?w,website_to_category?wc?WHERE?w.id=wc.website_id?and?wc.category_id=#{category_id} </select>直接執(zhí)行中間類的兩個(gè)方法是都可以查詢出來(lái)的,但放在collection中子查詢就不行開(kāi)始我在websitemapper中的resultmap中的collenction的column寫的市sebsite_id,查詢出來(lái)的對(duì)象list是空的又改成column="{website_id=id}"想讓他強(qiáng)制執(zhí)行,結(jié)果就一直報(bào)錯(cuò)Error instantiating class java.lang.Integer with invalid types () or values (). Cause: java.lang.NoSuchMethodException: java.lang.Integer.<init>()
查看完整描述

3 回答

?
精慕門9254224

TA貢獻(xiàn)167條經(jīng)驗(yàn) 獲得超46個(gè)贊

parameterType 要寫成java.lang.Integer

查看完整回答
反對(duì) 回復(fù) 2017-09-02
  • 3 回答
  • 0 關(guān)注
  • 7102 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)