zoukankan      html  css  js  c++  java
  • Atitit.mybatis的测试  以及spring与mybatis在本项目中的集成配置说明

    Atitit.mybatis的测试  以及springmybatis在本项目中的集成配置说明

     

    1.1. Mybatis invoke1

    1.2. Spring的数据源配置2

    1.3. Mybatis配置文件的位置2

     

    1.1. Mybatis invoke

     

    /AtiPlat_train/src/com/attilax/db/mybatisTO91.java

     

     @SuppressWarnings("all")

    public static void main(String[] args) throws IOException {

           // TODO Auto-generated method stub

         

               String resource = "com/attilax/db/ibatiascfg.xml";

               Reader reader;

     

     

               reader = Resources.getResourceAsReader(resource);

     

     

               SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()

                       .build(reader);

               SqlSession sqlSession = sqlSessionFactory.openSession();

           List li=   sqlSession.selectList("getLockTables", 9999999);

    //            StudentDao studentDao =sqlSession.getMapper(StudentDao.class);

    //            Student st = studentDao.getstudent(1);

                System.out.println( li.size());

               

               List li2=    sqlSession.selectList("findRecords"," select 1 as tit ");

               System.out.println(core.toJsonStrO88(li2));

               

           }

     

     

    1.2. Spring的数据源配置

    D:\0workspace\AtiPlatf_train\src\applicationContext.xml

     

    <context:property-placeholder location="classpath:jdbc.properties"/>

       <!-- ati add q213 -->

       <bean id="dataSource"   

      class="org.springframework.jdbc.datasource.DriverManagerDataSource">   

        <property name="driverClassName" value="${ct.jdbc.driverClassName}" />

        <property name="url" value="${ct.jdbc.url}" />

     

     

    作者::  ★(attilax)>>>   绰号:老哇的爪子  全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊  汉字名:艾龙,  EMAIL:1466519819@qq.com

    转载请注明来源: http://blog.csdn.net/attilax

     

    1.3. Mybatis配置文件的位置

     <!-- 数据访问入口 -->

        <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" p:configLocation="classpath:/config/ibatis/sql-map-config.xml" p:dataSource-ref="dataSource"/>

        

  • 相关阅读:
    Codeforces 1105
    Codeforces 1138
    Codeforces 1111
    【Linux远程连接工具】Xshell、Xftp家庭/学生版(免费使用)
    使用ssh localhost命令,发生异常ssh: connect to host localhost port 22: Connection refused
    【终端使用】拷贝和移动文件
    【终端使用】文件、目录的创建和删除
    【终端使用】切换目录
    【终端使用】"ls"命令,查看目录内容
    【终端使用】终端命令的格式
  • 原文地址:https://www.cnblogs.com/attilax/p/15198557.html
Copyright © 2011-2022 走看看