傳入mybatis的xml為Long型時報There is no getter for property named 'VARCHAR' in


修改前

  <insert id="insert" parameterType="com.taotao.pojo.TbContent" >
    insert into tb_content (id, category_id, title,
      sub_title, title_desc, url,
      pic, pic2, created,
      updated, content)
    values (${id,jdbcType=BIGINT}, ${categoryId,jdbcType=BIGINT}, ${title,jdbcType=VARCHAR},
     ${subTitle,jdbcType=VARCHAR}, ${titleDesc,jdbcType=VARCHAR}, ${url,jdbcType=VARCHAR},
      ${pic,jdbcType=VARCHAR}, ${pic2,jdbcType=VARCHAR}, ${created,jdbcType=TIMESTAMP},
      ${updated,jdbcType=TIMESTAMP},${content,jdbcType=LONGVARCHAR})
  </insert>

 

修改后

  <insert id="insert" parameterType="com.taotao.pojo.TbContent" >
    insert into tb_content (id, category_id, title,
      sub_title, title_desc, url,
      pic, pic2, created,
      updated, content)
    values (#{id,jdbcType=BIGINT}, #{categoryId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR},
      #{subTitle,jdbcType=VARCHAR}, #{titleDesc,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR},
      #{pic,jdbcType=VARCHAR}, #{pic2,jdbcType=VARCHAR}, #{created,jdbcType=TIMESTAMP},
      #{updated,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR})
  </insert>

 主要是#{}和${}的區別 如果不懂的可以點擊查看Mybatis中#{}和${}傳參的區別及#和$的區別小結


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM