xxxMapper.xml简单crud
发布时间:2020-12-16 08:35:44 所属栏目:百科 来源:网络整理
导读:?xml version="1.0" encoding="UTF-8" ?!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"!-- namespce是查找SQL映射文件的唯一标识,必须唯一 --mapper namespace="org.mybatis.example.BlogMappe
<?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"> <!-- namespce是查找SQL映射文件的唯一标识,必须唯一 --> <mapper namespace="org.mybatis.example.BlogMapper"> <!-- id是SQL映射文件中方法的唯一标识 --> <!-- parameterType是参数数据类型 --> <!-- resultType是实体类的全类名 --> <select id="getBlog" parameterType="int" resultTYpe="org.mybatis.example.Blog"> select * from Blog where id = #{id} </select> <!--新增时parameterType是对象类型,值为全类名 --> <insert id="addBlog" parameterType="org.mybatis.example.Blog"> <!-- 占位符中的名称要和对象的属性名称一致 --> insert into blog(name,age) values(#{name},#{age}) </insert> <delete id="deleteBlog" parameterType="int"> delete from blod where id=#{id} </delete> <update id="updateBlog" parameterType="org.mybatis.example.Blog"> update blog set name=#{name},age=#{age} where id=#{id} </update> </mapper>
factory.openSession(true);//true会自动自提事物 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Oracle中Like与Instr模糊查询性能大比拼
- cocos2d-x多分辨率适配
- 数组 – Ruby中更快的是`arr = [x]`或`arr << x`
- ruby-on-rails – 在使用capistrano和svn部署rails时,在哪里
- c# – 无法读取包含&符号的XML文档
- c# – 将大量行写入文本文件的有效方法
- 写STM8flash和写外部flash EN25Q16A-104HIP 的函数小纪
- 非常常用的正则表达式
- xml – 任何人都可以为VIN号码推荐一个REST / SOAP Web服务
- ruby-on-rails – 您没有写入/var/lib/gems/1.9.1目录的权限