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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM