千家信息网

主题:Mybatis3.0查询,保存,更新,删除数据。

发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,近来打算开发一个技术框架,并应用此框架开发出一个论坛,开始打算用sturts2+spring+hibernate+jquery为基础,然后再进行封装,最后形成技术框架,但通过此网站获知mybatis比
千家信息网最后更新 2025年01月20日主题:Mybatis3.0查询,保存,更新,删除数据。

近来打算开发一个技术框架,并应用此框架开发出一个论坛,开始打算用sturts2+spring+hibernate+jquery为基础,然后再进行封装,最后形成技术框架,但通过此网站获知mybatis比hibernate更灵活,实用。因此开始逐步接触mybatis。

以下是mybatis3.0的开发实例,使用的java环境jdk5.0,ide为eclipse3.7,数据库是oracle11g。

1.数据环境配置

Xml代码

  1. xml version="1.0" encoding="UTF-8"?>

  2. >


  3. <configuration>

  4. <environments default="environments">

  5. <environment id="eassen">

  6. <transactionManager type="JDBC"/>

  7. <dataSource type="POOLED">

  8. <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>

  9. <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:eassen"/>

  10. <property name="username" value="eassen"/>

  11. <property name="password" value="oracle"/>

  12. dataSource>

  13. environment>

  14. environments>

  15. <mappers>

  16. <mapper resource="com/pojo/sql/DmMydwtMapper.xml"/>

  17. mappers>

  18. configuration>

Xml代码

  1. xml version="1.0" encoding="UTF-8"?>

  2. >

  3. <configuration>

  4. <environments default="environments">

  5. <environment id="eassen">

  6. <transactionManager type="JDBC"/>

  7. <dataSource type="POOLED">

  8. <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>

  9. <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:eassen"/>

  10. <property name="username" value="eassen"/>

  11. <property name="password" value="oracle"/>

  12. dataSource>

  13. environment>

  14. environments>

  15. <mappers>

  16. <mapper resource="com/pojo/sql/DmMydwtMapper.xml"/>

  17. mappers>

  18. configuration>

2.数据库表映射(DM_MYDWT)XML文件

Xml代码

  1. xml version="1.0" encoding="UTF-8" ?>

  2. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

  3. <mapper namespace="com.dao.DmMydwtMapper">

  4. <resultMap id="BaseResultMap" type="com.pojo.DmMydwt">

  5. <id column="MYDWT_DM" property="mydwtDm" jdbcType="CHAR" javaType="String" />

  6. <result column="MYDWT_MC" property="mydwtMc" jdbcType="VARCHAR"

  7. javaType="String" />

  8. <result column="YXBZ" property="yxbz" jdbcType="CHAR" javaType="String" />

  9. <result column="XYBZ" property="xybz" jdbcType="CHAR" javaType="String" />

  10. resultMap>

  11. <sql id="Base_Column_List">

  12. MYDWT_DM, MYDWT_MC, YXBZ, XYBZ

  13. sql>

  14. <select id="selectByPrimaryKey" resultMap="BaseResultMap"

  15. parameterType="java.lang.String">

  16. select

  17. <include refid="Base_Column_List" />

  18. from EASSEN.DM_MYDWT

  19. where MYDWT_DM = #{mydwtDm,jdbcType=CHAR}

  20. select>

  21. <delete id="deleteByPrimaryKey" parameterType="java.lang.String"

  22. flushCache="true">

  23. delete from EASSEN.DM_MYDWT

  24. where MYDWT_DM =

  25. #{mydwtDm,jdbcType=CHAR}

  26. delete>

  27. <insert id="insert" parameterType="com.pojo.DmMydwt" flushCache="true">

  28. insert into EASSEN.DM_MYDWT (MYDWT_DM, MYDWT_MC, YXBZ,

  29. XYBZ)

  30. values

  31. (#{mydwtDm,jdbcType=CHAR}, #{mydwtMc,jdbcType=VARCHAR},

  32. #{yxbz,jdbcType=CHAR},

  33. #{xybz,jdbcType=CHAR})

  34. insert>

  35. <insert id="insertSelective" parameterType="com.pojo.DmMydwt"

  36. flushCache="true">

  37. insert into EASSEN.DM_MYDWT

  38. <trim prefix="(" suffix=")" suffixOverrides=",">

  39. MYDWT_DM,

  40. MYDWT_MC,

  41. YXBZ,

  42. XYBZ,

  43. trim>

  44. <trim prefix="values (" suffix=")" suffixOverrides=",">

  45. #{mydwtDm,jdbcType=CHAR},

  46. #{mydwtMc},

  47. #{yxbz,jdbcType=CHAR},

  48. #{xybz,jdbcType=CHAR},

  49. trim>

  50. insert>

  51. <update id="updateByPrimaryKeySelective" parameterType="com.pojo.DmMydwt"

  52. flushCache="true">

  53. update EASSEN.DM_MYDWT

  54. <set>

  55. <if test="mydwtMc != null">

  56. MYDWT_MC = #{mydwtMc,jdbcType=VARCHAR},

  57. if>

  58. <if test="yxbz != null">

  59. YXBZ = #{yxbz,jdbcType=CHAR},

  60. if>

  61. <if test="xybz != null">

  62. XYBZ = #{xybz,jdbcType=CHAR},

  63. if>

  64. set>

  65. where MYDWT_DM = #{mydwtDm,jdbcType=CHAR}

  66. update>

  67. <update id="updateByPrimaryKey" parameterType="com.pojo.DmMydwt"

  68. flushCache="true">

  69. update EASSEN.DM_MYDWT

  70. set MYDWT_MC =

  71. #{mydwtMc,jdbcType=VARCHAR},

  72. YXBZ = #{yxbz,jdbcType=CHAR},

  73. XYBZ =

  74. #{xybz,jdbcType=CHAR}

  75. where MYDWT_DM = #{mydwtDm,jdbcType=CHAR}

  76. update>

  77. mapper>

Xml代码

  1. xml version="1.0" encoding="UTF-8" ?>

  2. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

  3. <mapper namespace="com.dao.DmMydwtMapper">

  4. <resultMap id="BaseResultMap" type="com.pojo.DmMydwt">

  5. <id column="MYDWT_DM" property="mydwtDm" jdbcType="CHAR" javaType="String" />

  6. <result column="MYDWT_MC" property="mydwtMc" jdbcType="VARCHAR"

  7. javaType="String" />

  8. <result column="YXBZ" property="yxbz" jdbcType="CHAR" javaType="String" />

  9. <result column="XYBZ" property="xybz" jdbcType="CHAR" javaType="String" />

  10. resultMap>

  11. <sql id="Base_Column_List">

  12. MYDWT_DM, MYDWT_MC, YXBZ, XYBZ

  13. sql>

  14. <select id="selectByPrimaryKey" resultMap="BaseResultMap"

  15. parameterType="java.lang.String">

  16. select

  17. <include refid="Base_Column_List" />

  18. from EASSEN.DM_MYDWT

  19. where MYDWT_DM = #{mydwtDm,jdbcType=CHAR}

  20. select>

  21. <delete id="deleteByPrimaryKey" parameterType="java.lang.String"

  22. flushCache="true">

  23. delete from EASSEN.DM_MYDWT

  24. where MYDWT_DM =

  25. #{mydwtDm,jdbcType=CHAR}

  26. delete>

  27. <insert id="insert" parameterType="com.pojo.DmMydwt" flushCache="true">

  28. insert into EASSEN.DM_MYDWT (MYDWT_DM, MYDWT_MC, YXBZ,

  29. XYBZ)

  30. values

  31. (#{mydwtDm,jdbcType=CHAR}, #{mydwtMc,jdbcType=VARCHAR},

  32. #{yxbz,jdbcType=CHAR},

  33. #{xybz,jdbcType=CHAR})

  34. insert>

  35. <insert id="insertSelective" parameterType="com.pojo.DmMydwt"

  36. flushCache="true">

  37. insert into EASSEN.DM_MYDWT

  38. <trim prefix="(" suffix=")" suffixOverrides=",">

  39. MYDWT_DM,

  40. MYDWT_MC,

  41. YXBZ,

  42. XYBZ,

  43. trim>

  44. <trim prefix="values (" suffix=")" suffixOverrides=",">

  45. #{mydwtDm,jdbcType=CHAR},

  46. #{mydwtMc},

  47. #{yxbz,jdbcType=CHAR},

  48. #{xybz,jdbcType=CHAR},

  49. trim>

  50. insert>

  51. <update id="updateByPrimaryKeySelective" parameterType="com.pojo.DmMydwt"

  52. flushCache="true">

  53. update EASSEN.DM_MYDWT

  54. <set>

  55. <if test="mydwtMc != null">

  56. MYDWT_MC = #{mydwtMc,jdbcType=VARCHAR},

  57. if>

  58. <if test="yxbz != null">

  59. YXBZ = #{yxbz,jdbcType=CHAR},

  60. if>

  61. <if test="xybz != null">

  62. XYBZ = #{xybz,jdbcType=CHAR},

  63. if>

  64. set>

  65. where MYDWT_DM = #{mydwtDm,jdbcType=CHAR}

  66. update>

  67. <update id="updateByPrimaryKey" parameterType="com.pojo.DmMydwt"

  68. flushCache="true">

  69. update EASSEN.DM_MYDWT

  70. set MYDWT_MC =

  71. #{mydwtMc,jdbcType=VARCHAR},

  72. YXBZ = #{yxbz,jdbcType=CHAR},

  73. XYBZ =

  74. #{xybz,jdbcType=CHAR}

  75. where MYDWT_DM = #{mydwtDm,jdbcType=CHAR}

  76. update>

  77. mapper>

3.数据库表(DM_MYDWT)java

Java代码

  1. package com.pojo;


  2. import java.io.Serializable;


  3. public class DmMydwt implements Serializable {

  4. /**

  5. *

  6. */

  7. private static final long serialVersionUID = 1078518054837885063L;


  8. /**

  9. * EASSEN.DM_MYDWT.MYDWT_DM

  10. * @ibatorgenerated 2012-02-05 20:14:30

  11. */

  12. private String mydwtDm;


  13. /**

  14. * EASSEN.DM_MYDWT.MYDWT_MC

  15. * @ibatorgenerated 2012-02-05 20:14:30

  16. */

  17. private String mydwtMc;


  18. /**

  19. * EASSEN.DM_MYDWT.YXBZ

  20. * @ibatorgenerated 2012-02-05 20:14:30

  21. */

  22. private String yxbz;


  23. /**

  24. * EASSEN.DM_MYDWT.XYBZ

  25. * @ibatorgenerated 2012-02-05 20:14:30

  26. */

  27. private String xybz;


  28. public String getMydwtDm() {

  29. return mydwtDm;

  30. }


  31. public void setMydwtDm(String mydwtDm) {

  32. this.mydwtDm = mydwtDm;

  33. }


  34. public String getMydwtMc() {

  35. return mydwtMc;

  36. }


  37. public void setMydwtMc(String mydwtMc) {

  38. this.mydwtMc = mydwtMc;

  39. }


  40. public String getYxbz() {

  41. return yxbz;

  42. }


  43. public void setYxbz(String yxbz) {

  44. this.yxbz = yxbz;

  45. }


  46. public String getXybz() {

  47. return xybz;

  48. }


  49. public void setXybz(String xybz) {

  50. this.xybz = xybz;

  51. }

  52. }

Java代码

  1. package com.pojo;

  2. import java.io.Serializable;

  3. public class DmMydwt implements Serializable {

  4. /**

  5. *

  6. */

  7. private static final long serialVersionUID = 1078518054837885063L;

  8. /**

  9. * EASSEN.DM_MYDWT.MYDWT_DM

  10. * @ibatorgenerated 2012-02-05 20:14:30

  11. */

  12. private String mydwtDm;

  13. /**

  14. * EASSEN.DM_MYDWT.MYDWT_MC

  15. * @ibatorgenerated 2012-02-05 20:14:30

  16. */

  17. private String mydwtMc;

  18. /**

  19. * EASSEN.DM_MYDWT.YXBZ

  20. * @ibatorgenerated 2012-02-05 20:14:30

  21. */

  22. private String yxbz;

  23. /**

  24. * EASSEN.DM_MYDWT.XYBZ

  25. * @ibatorgenerated 2012-02-05 20:14:30

  26. */

  27. private String xybz;

  28. public String getMydwtDm() {

  29. return mydwtDm;

  30. }

  31. public void setMydwtDm(String mydwtDm) {

  32. this.mydwtDm = mydwtDm;

  33. }

  34. public String getMydwtMc() {

  35. return mydwtMc;

  36. }

  37. public void setMydwtMc(String mydwtMc) {

  38. this.mydwtMc = mydwtMc;

  39. }

  40. public String getYxbz() {

  41. return yxbz;

  42. }

  43. public void setYxbz(String yxbz) {

  44. this.yxbz = yxbz;

  45. }

  46. public String getXybz() {

  47. return xybz;

  48. }

  49. public void setXybz(String xybz) {

  50. this.xybz = xybz;

  51. }

  52. }

4.DAO

Java代码

  1. package com.dao;


  2. import com.pojo.DmMydwt;


  3. public interface DmMydwtMapper {

  4. /**

  5. * 根据主键删除

  6. * 参数:主键

  7. * 返回:删除个数

  8. * @ibatorgenerated 2012-02-05 20:14:58

  9. */

  10. int deleteByPrimaryKey(String mydwtDm);


  11. /**

  12. * 插入,空属性也会插入

  13. * 参数:pojo对象

  14. * 返回:删除个数

  15. * @ibatorgenerated 2012-02-05 20:14:58

  16. */

  17. int insert(DmMydwt record);


  18. /**

  19. * 插入,空属性不会插入

  20. * 参数:pojo对象

  21. * 返回:删除个数

  22. * @ibatorgenerated 2012-02-05 20:14:58

  23. */

  24. int insertSelective(DmMydwt record);


  25. /**

  26. * 根据主键查询

  27. * 参数:查询条件,主键值

  28. * 返回:对象

  29. * @ibatorgenerated 2012-02-05 20:14:58

  30. */

  31. DmMydwt selectByPrimaryKey(String mydwtDm);


  32. /**

  33. * 根据主键修改,空值条件不会修改成null

  34. * 参数:1.要修改成的值

  35. * 返回:成功修改个数

  36. * @ibatorgenerated 2012-02-05 20:14:58

  37. */

  38. int updateByPrimaryKeySelective(DmMydwt record);


  39. /**

  40. * 根据主键修改,空值条件会修改成null

  41. * 参数:1.要修改成的值

  42. * 返回:成功修改个数

  43. * @ibatorgenerated 2012-02-05 20:14:58

  44. */

  45. int updateByPrimaryKey(DmMydwt record);

  46. }

Java代码

  1. package com.dao;

  2. import com.pojo.DmMydwt;

  3. public interface DmMydwtMapper {

  4. /**

  5. * 根据主键删除

  6. * 参数:主键

  7. * 返回:删除个数

  8. * @ibatorgenerated 2012-02-05 20:14:58

  9. */

  10. int deleteByPrimaryKey(String mydwtDm);

  11. /**

  12. * 插入,空属性也会插入

  13. * 参数:pojo对象

  14. * 返回:删除个数

  15. * @ibatorgenerated 2012-02-05 20:14:58

  16. */

  17. int insert(DmMydwt record);

  18. /**

  19. * 插入,空属性不会插入

  20. * 参数:pojo对象

  21. * 返回:删除个数

  22. * @ibatorgenerated 2012-02-05 20:14:58

  23. */

  24. int insertSelective(DmMydwt record);

  25. /**

  26. * 根据主键查询

  27. * 参数:查询条件,主键值

  28. * 返回:对象

  29. * @ibatorgenerated 2012-02-05 20:14:58

  30. */

  31. DmMydwt selectByPrimaryKey(String mydwtDm);

  32. /**

  33. * 根据主键修改,空值条件不会修改成null

  34. * 参数:1.要修改成的值

  35. * 返回:成功修改个数

  36. * @ibatorgenerated 2012-02-05 20:14:58

  37. */

  38. int updateByPrimaryKeySelective(DmMydwt record);

  39. /**

  40. * 根据主键修改,空值条件会修改成null

  41. * 参数:1.要修改成的值

  42. * 返回:成功修改个数

  43. * @ibatorgenerated 2012-02-05 20:14:58

  44. */

  45. int updateByPrimaryKey(DmMydwt record);

  46. }

5.mybatis加载

Java代码

  1. package com.db;


  2. import java.io.IOException;

  3. import java.io.Reader;

  4. import org.apache.ibatis.io.Resources;

  5. import org.apache.ibatis.session.SqlSession;

  6. import org.apache.ibatis.session.SqlSessionFactory;

  7. import org.apache.ibatis.session.SqlSessionFactoryBuilder;


  8. public class ConnectionFactory {

  9. private static SqlSessionFactory factory;

  10. private static SqlSession sqlSession = null;



  11. // 读取MyBatis配置文件,创建SqlSessionFactory

  12. static {

  13. try {

  14. Reader reader = Resources.getResourceAsReader("sqlMapConfig.xml");

  15. factory = new SqlSessionFactoryBuilder().build(reader, "eassen");

  16. } catch (IOException e) {

  17. e.printStackTrace();

  18. }

  19. }


  20. /**

  21. * 获取SqlSession

  22. * @return

  23. */

  24. public static SqlSession getSession() {

  25. if(sqlSession == null){

  26. sqlSession = factory.openSession();

  27. }

  28. return sqlSession;

  29. }


  30. /**

  31. * 从配置文件中获取数据库表映射对象信息

  32. * @param mapper

  33. * @return

  34. */

  35. public static T getMapper(Class mapper) {

  36. SqlSession session = getSession();

  37. return (T) session.getMapper(mapper);

  38. }


  39. /**

  40. * 数据提交

  41. */

  42. public static void commit(){

  43. sqlSession.commit();

  44. }

  45. /**

  46. * 数据回滚

  47. */

  48. public static void rollback(){

  49. sqlSession.rollback();

  50. }

  51. /**

  52. * 关闭sqlsession

  53. */

  54. public static void close(){

  55. if(sqlSession != null){

  56. sqlSession.close();

  57. }

  58. }



  59. }

Java代码

  1. package com.db;

  2. import java.io.IOException;

  3. import java.io.Reader;

  4. import org.apache.ibatis.io.Resources;

  5. import org.apache.ibatis.session.SqlSession;

  6. import org.apache.ibatis.session.SqlSessionFactory;

  7. import org.apache.ibatis.session.SqlSessionFactoryBuilder;

  8. public class ConnectionFactory {

  9. private static SqlSessionFactory factory;

  10. private static SqlSession sqlSession = null;

  11. // 读取MyBatis配置文件,创建SqlSessionFactory

  12. static {

  13. try {

  14. Reader reader = Resources.getResourceAsReader("sqlMapConfig.xml");

  15. factory = new SqlSessionFactoryBuilder().build(reader, "eassen");

  16. } catch (IOException e) {

  17. e.printStackTrace();

  18. }

  19. }

  20. /**

  21. * 获取SqlSession

  22. * @return

  23. */

  24. public static SqlSession getSession() {

  25. if(sqlSession == null){

  26. sqlSession = factory.openSession();

  27. }

  28. return sqlSession;

  29. }

  30. /**

  31. * 从配置文件中获取数据库表映射对象信息

  32. * @param mapper

  33. * @return

  34. */

  35. public static T getMapper(Class mapper) {

  36. SqlSession session = getSession();

  37. return (T) session.getMapper(mapper);

  38. }

  39. /**

  40. * 数据提交

  41. */

  42. public static void commit(){

  43. sqlSession.commit();

  44. }

  45. /**

  46. * 数据回滚

  47. */

  48. public static void rollback(){

  49. sqlSession.rollback();

  50. }

  51. /**

  52. * 关闭sqlsession

  53. */

  54. public static void close(){

  55. if(sqlSession != null){

  56. sqlSession.close();

  57. }

  58. }

  59. }

6.数据查询,插入,更新,删除测试

Java代码

  1. package com.test;


  2. import com.dao.DmMydwtMapper;

  3. import com.db.ConnectionFactory;

  4. import com.pojo.DmMydwt;


  5. public class MydTest {


  6. public static void main(String[] args) {

  7. try {

  8. // 获取对象

  9. DmMydwtMapper mydwtMapper = ConnectionFactory

  10. .getMapper(com.dao.DmMydwtMapper.class);


  11. // 查询相关MYDWT_DM为"1001"的信息

  12. DmMydwt mydwt = mydwtMapper.selectByPrimaryKey("1001");

  13. System.out.println("mybatis查询测试:=================================");

  14. System.out.println("MYDWT_DM:" + mydwt.getMydwtDm());

  15. System.out.println("MYDWT_MC:" + mydwt.getMydwtMc());


  16. // 插入数据

  17. System.out.println("mybatis保存测试:=================================");

  18. mydwt = new DmMydwt();

  19. mydwt.setMydwtDm("aaaa");

  20. mydwt.setMydwtMc("mybatis保存");

  21. mydwt.setYxbz("Y");

  22. mydwt.setXybz("Y");

  23. mydwtMapper.insert(mydwt);

  24. // 更新数据

  25. System.out.println("mybatis更新测试:=================================");

  26. mydwt.setMydwtMc(new String("mybatis保存".getBytes(),"UTF-8"));

  27. mydwtMapper.updateByPrimaryKey(mydwt);


  28. // 删除数据

  29. System.out.println("mybatis删除测试:=================================");

  30. mydwtMapper.deleteByPrimaryKey("1001");

  31. ConnectionFactory.commit();

  32. } catch (Exception e) {

  33. ConnectionFactory.rollback();

  34. e.printStackTrace();

  35. } finally {

  36. // 关闭sqlsession

  37. ConnectionFactory.close();

  38. }

  39. }

  40. }

Java代码

  1. package com.test;

  2. import com.dao.DmMydwtMapper;

  3. import com.db.ConnectionFactory;

  4. import com.pojo.DmMydwt;

  5. public class MydTest {

  6. public static void main(String[] args) {

  7. try {

  8. // 获取对象

  9. DmMydwtMapper mydwtMapper = ConnectionFactory

  10. .getMapper(com.dao.DmMydwtMapper.class);

  11. // 查询相关MYDWT_DM为"1001"的信息

  12. DmMydwt mydwt = mydwtMapper.selectByPrimaryKey("1001");

  13. System.out.println("mybatis查询测试:=================================");

  14. System.out.println("MYDWT_DM:" + mydwt.getMydwtDm());

  15. System.out.println("MYDWT_MC:" + mydwt.getMydwtMc());

  16. // 插入数据

  17. System.out.println("mybatis保存测试:=================================");

  18. mydwt = new DmMydwt();

  19. mydwt.setMydwtDm("aaaa");

  20. mydwt.setMydwtMc("mybatis保存");

  21. mydwt.setYxbz("Y");

  22. mydwt.setXybz("Y");

  23. mydwtMapper.insert(mydwt);

  24. // 更新数据

  25. System.out.println("mybatis更新测试:=================================");

  26. mydwt.setMydwtMc(new String("mybatis保存".getBytes(),"UTF-8"));

  27. mydwtMapper.updateByPrimaryKey(mydwt);

  28. // 删除数据

  29. System.out.println("mybatis删除测试:=================================");

  30. mydwtMapper.deleteByPrimaryKey("1001");

  31. ConnectionFactory.commit();

  32. } catch (Exception e) {

  33. ConnectionFactory.rollback();

  34. e.printStackTrace();

  35. } finally {

  36. // 关闭sqlsession

  37. ConnectionFactory.close();

  38. }

  39. }

  40. }

7.控制台信息输出

Java代码

  1. 2012-02-08 11:43:01 Logging initialized using 'org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl'adapter.

  2. 2012-02-08 11:43:01 PooledDataSource forcefully closed/removed all connections.

  3. 2012-02-08 11:43:01 PooledDataSource forcefully closed/removed all connections.

  4. 2012-02-08 11:43:01 PooledDataSource forcefully closed/removed all connections.

  5. 2012-02-08 11:43:01 PooledDataSource forcefully closed/removed all connections.

  6. 2012-02-08 11:43:02 Created connection 17671659.

  7. 2012-02-08 11:43:02 ooo Connection Opened

  8. 2012-02-08 11:43:02 ==> Executing: select MYDWT_DM, MYDWT_MC, YXBZ, XYBZ from EASSEN.DM_MYDWT where MYDWT_DM = ?

  9. 2012-02-08 11:43:02 ==> Parameters: 1001(String)

  10. 2012-02-08 11:43:02 <== Columns: MYDWT_DM, MYDWT_MC, YXBZ, XYBZ

  11. 2012-02-08 11:43:02 <== Row: 1001, 您经常访问的网站包括:, Y, Y

  12. mybatis查询测试:=================================

  13. MYDWT_DM:1001

  14. MYDWT_MC:您经常访问的网站包括:

  15. mybatis保存测试:=================================

  16. 2012-02-08 11:43:02 ==> Executing: insert into EASSEN.DM_MYDWT (MYDWT_DM, MYDWT_MC, YXBZ, XYBZ) values (?, ?, ?, ?)

  17. 2012-02-08 11:43:02 ==> Parameters: aaaa(String), mybatis保存(String), Y(String), Y(String)

  18. mybatis更新测试:=================================

  19. 2012-02-08 11:43:02 ==> Executing: update EASSEN.DM_MYDWT set MYDWT_MC = ?, YXBZ = ?, XYBZ = ? where MYDWT_DM = ?

  20. 2012-02-08 11:43:02 ==> Parameters: mybatis保存(String), Y(String), Y(String), aaaa(String)

  21. mybatis删除测试:=================================

  22. 2012-02-08 11:43:02 ==> Executing: delete from EASSEN.DM_MYDWT where MYDWT_DM = ?

  23. 2012-02-08 11:43:02 ==> Parameters: 1001(String)

  24. 2012-02-08 11:43:02 xxx Connection Closed

  25. 2012-02-08 11:43:02 Returned connection 17671659 to pool.


0