传入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