这里记录一下orm配置文件的配置内容,基本的增删改查,可以作为配置的参考
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tong.xu.entity.HelloTest">
<select id="selectHelloTest" resultType="ht">
select * from hello_test
</select>
<insert id="insertHelloTest" parameterType="ht">
<selectKey keyProperty="ID" resultType="String" order="BEFORE">
select SEQ_HELLOTEST_001.Nextval from dual
</selectKey>
insert into hello_test values (#{ID},#{Hello_Data,jdbcType=VARCHAR})
</insert>
<update id="updateHelloTest" parameterType="ht">
update hello_test set Hello_Data = #{Hello_Data} where id = #{ID,jdbcType= VARCHAR}
</update>
<delete id="deleteHelloTest" parameterType="String">
delete from hello_test where id = #{value}
</delete>
<select id="queryById" parameterType="String" resultType="ht">
select ID,hello_Data from hello_test where id = #{value}
</select>
<select id="SearchQuery" parameterType="string" resultType="ht">
select ID,hello_data from hello_test where id like '%'||#{value}||'%'
</select>
<select id="SearchQuery2" parameterType="string" resultType="ht">
select ID,hello_data from hello_test where id like #{value}
</select>
<select id="querySpecialCharacter" resultType="string">
<![CDATA[
select ID,Hello_data from hello_test where id <'100'
]]>
</select>
</mapper>

本文详细介绍了MyBatis的ORM配置文件设置,包括基本的增删改查操作示例,适合用作配置参考。内容覆盖了XML映射文件的DTD声明、命名空间定义、SQL语句的编写及参数类型指定。
752

被折叠的 条评论
为什么被折叠?



