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