報錯`Message.xml中報錯`
錯誤內(nèi)容?Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: 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 'UserAlias'. ?Cause: java.lang.ClassNotFoundException: Cannot find class: UserAlias
<mapper namespace="Message">
? <!-- type對應的哪個實體類,id要在resultMap中唯一 ?-->
? <resultMap type="bean.Message" id="MessageResult">
? ? <!-- 數(shù)據(jù)庫中主鍵用ID標簽 ?-->
? ? <!-- column對應數(shù)據(jù)庫中的字段名,property對應了實體類中的屬性名 ,jdbcType對應了數(shù)據(jù)庫中的屬性類型-->
? ? <id column="ID" jdbcType="INTEGER" property="id"/>
? ? <!-- 數(shù)據(jù)庫中普通字段用result標簽 -->
? ? <result column="COMMAND" jdbcType="VARCHAR" property="command"/>
? ? <result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
? ? <result column="CONTENT" jdbcType="VARCHAR" property="content"/>
? </resultMap>
?<!-- Mybatis中的配置信息,應用在一條具體的SQL語句上,通過resultMap標簽指向相對應的id名 ?-->
? <select id="queryMessageList" resultMap="MessageResult">
? ? select ID,COMMAND,DESCRIPTION,CONTENT from message where 1=1
? </select>
? <select id="version" parameterType="long" resultType="int">
? ? SELECT version FROM user WHERE id = #{id,jdbcType=INTEGER}
? </select>
? <delete id="delete" parameterType="UserAlias">
? ? DELETE FROM user WHERE id = #{id:INTEGER}
? </delete>
? <insert id="insert" parameterType="UserAlias" useGeneratedKeys="false">
? ? INSERT INTO user
? ? ( id,
? ? username,
? ? password,
? ? administrator
? ? )
? ? VALUES
? ? ( #{id},
? ? #{username,jdbcType=VARCHAR},
? ? #{password.encrypted:VARCHAR},
? ? #{administrator,jdbcType=BOOLEAN}
? ? )
? </insert>
? <update id="update" parameterType="UserAlias">
? ? UPDATE user SET
? ? username = #{username,jdbcType=VARCHAR},
? ? password = #{password.encrypted,jdbcType=VARCHAR},
? ? administrator = #{administrator,jdbcType=BOOLEAN}
? ? WHERE
? ? id = #{id,jdbcType=INTEGER}
? </update>
? <!-- ? Unique constraint check -->
? <select id="isUniqueUsername" parameterType="map" resultType="boolean">
? ? SELECT (count(*) = 0)
? ? FROM user
? ? WHERE ((#{userId,jdbcType=BIGINT} IS NOT NULL AND id != #{userId,jdbcType=BIGINT}) OR #{userId,jdbcType=BIGINT} IS
? ? NULL) ?<!-- other than me -->
? ? AND (username = #{username,jdbcType=VARCHAR})
? </select>
</mapper>
查看了下`是下面的刪除和插入等``parameterType="UserAlias"報找不到``如何處理?刪掉下面的SQL語句么?
2017-03-20
把你的這個刪除就可以了!
<select id="version" parameterType="long" resultType="int">
? ? SELECT version FROM user WHERE id = #{id,jdbcType=INTEGER}
? </select>
? <delete id="delete" parameterType="UserAlias">
? ? DELETE FROM user WHERE id = #{id:INTEGER}
? </delete>
? <insert id="insert" parameterType="UserAlias" useGeneratedKeys="false">
? ? INSERT INTO user
? ? ( id,
? ? username,
? ? password,
? ? administrator
? ? )
? ? VALUES
? ? ( #{id},
? ? #{username,jdbcType=VARCHAR},
? ? #{password.encrypted:VARCHAR},
? ? #{administrator,jdbcType=BOOLEAN}
? ? )
? </insert>
? <update id="update" parameterType="UserAlias">
? ? UPDATE user SET
? ? username = #{username,jdbcType=VARCHAR},
? ? password = #{password.encrypted,jdbcType=VARCHAR},
? ? administrator = #{administrator,jdbcType=BOOLEAN}
? ? WHERE
? ? id = #{id,jdbcType=INTEGER}
? </update>
? <!-- ? Unique constraint check -->
? <select id="isUniqueUsername" parameterType="map" resultType="boolean">
? ? SELECT (count(*) = 0)
? ? FROM user
? ? WHERE ((#{userId,jdbcType=BIGINT} IS NOT NULL AND id != #{userId,jdbcType=BIGINT}) OR #{userId,jdbcType=BIGINT} IS
? ? NULL) ?<!-- other than me -->
? ? AND (username = #{username,jdbcType=VARCHAR})
? </select>
2017-02-09
刪除?
<!-- Mybatis中的配置信息,應用在一條具體的SQL語句上,通過resultMap標簽指向相對應的id名 ?-->
? <select id="queryMessageList" resultMap="MessageResult">
? ? select ID,COMMAND,DESCRIPTION,CONTENT from message where 1=1
? </select>
之后的sql語句