今天使用Mybatis,配置了XML文件後,啓動時候報錯,錯誤信息如下:
xml中的insert配置如下:
<!-- 添加用戶 -->
<insert id="addUser" parameterType="com.ltf.entity.User"
useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<selectKey keyProperty="id" resultType="java.lang.Integer"
order="after">
select
last_insert_id()
</selectKey>
insert into
<include refid="table" />
(
<include refid="edu_user_column" />
)
values(
<include refid="edu_user_property" />
)
</insert>
錯誤原因:order值必須爲“BEFORE AFTER”中的一個,大小寫敏感。
改正:把after改爲AFTER。