• Mybatis数据库操作的返回值


    mybatis配置

    <!-- 配置mybatis -->
        <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
            <property name="dataSource" ref="dataSource" />
            <property name="configLocation" value="classpath:mybatis/mybatis-config.xml"/>
            <!-- mapper扫描 -->
            <property name="mapperLocations" value="classpath:mybatis/mapper/*.xml"/>
        </bean>
    
        <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
            <constructor-arg ref="sqlSessionFactory" />
        </bean>
    
        <!-- mapper批量扫描,从mapper包中扫描mapper接口,自动创建代理对象并且在spring容器中注册 -->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <!-- 如果扫描多个包,每个包中间用,号分隔,不能使用通配符 -->
            <property name="basePackage" value="com.dqc.dal.dao" />
            <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
        </bean>

     从配置文件可知所用的sqlSessionTemplate为:org.mybatis.spring.SqlSessionTemplate,进入源码

    然后跳转到:可以看到注释里的说明:@return int The number of rows affected by the delete.

    注意,一定要下载jar包的源码,才可以看到注释的内容

    参考:

    https://blog.csdn.net/gaojinshan/article/details/24308313

  • 相关阅读:
    数据分析优化之惩罚性线性回归算法
    数据分析之贝叶斯算法案例
    SSM-CRUD练习
    使用 Code First 迁移以设定数据库种子
    .Net Web Api相关学习内容
    ASP.NET MVC5的学习知识点
    Entity Framework的学习(ASP.NET MVC5的学习中的一部分)
    EFCore框架的学习
    jsp中的<%%>用法
    nginx出现404和403错误
  • 原文地址:https://www.cnblogs.com/shengulong/p/9967690.html
Copyright © 2020-2023  润新知