• org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.build


    使用SSM框架,添加一个新的Mapper.xml文件后,运行项目报错:

    org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Blog'.  Cause: java.lang.ClassNotFoundException: Cannot find class: Blog

    开始我的Mapper是这样设置的:

    <mapper namespace="com.online.dao.BlogDao">
        <!--保存Blog-->
        <insert id="saveBlog" parameterType="Blog">
           insert into blog(title,summary,content,htmlContent)values(#{title},#{summary},#{content},#{htmlContent});
        </insert>
    </mapper>

    原因是因为parameterType的路径不是完整路径,改为完整路径就可以了。

    <mapper namespace="com.online.dao.BlogDao">
        <!--保存Blog-->
        <insert id="saveBlog" parameterType="com.online.domain.Blog">
            <selectKey keyProperty="id" keyColumn="id" resultType="int" order="AFTER">
                select last_insert_id();
            </selectKey>
            insert into blog(title,summary,content,htmlContent)values(#{title},#{summary},#{content},#{htmlContent});
        </insert>
    </mapper>
  • 相关阅读:
    用面向对象做练习题
    面向对象
    php数组
    PHP函数
    php语句函数
    mySQL函数
    mySQL相关知识
    mySQL建表及练习题(下)
    mySQL建表及练习题(上)
    HTML5 canvas画布标签
  • 原文地址:https://www.cnblogs.com/mxxbc/p/14039016.html
Copyright © 2020-2023  润新知