当前位置: 首页 > news >正文

asp.net做网站野狼seo团队

asp.net做网站,野狼seo团队,mq网站开发,网站负责人照片1.概念 事务就是用户定义的一系列执行SQL语句的操作, 这些操作要么完全地执行,要么完全地都不执行, 它是一个不可分割的工作执行单元 一个使用Mybatis-Spring的主要原因是它允许Mybatis参与到Spring的事务管理中,而不是给Mybatis创建一个新的…

1.概念 

  • 事务就是用户定义的一系列执行SQL语句的操作, 这些操作要么完全地执行,要么完全地都不执行, 它是一个不可分割的工作执行单元
  • 一个使用Mybatis-Spring的主要原因是它允许Mybatis参与到Spring的事务管理中,而不是给Mybatis创建一个新的专用事务管理器 

2.步骤

2.1.spring配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beanshttps://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop.xsd"><!--Spring整合Mybatis,省略了Mybatis的核心配置文件,转而在Spring的配置文件中配置Mybatis--><!--datasource--><bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"><property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/><property name="url" value="jdbc:mysql://localhost:3306/user?useSSL=false&amp;useUnicode=true&amp;characterEncoding=UTF-8"/><property name="username" value="root"/><property name="password" value="123456"/></bean><!--sqlSessionFactory--><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="dataSource" />
<!--        <property name="configLocation" value="classpath:mybatis-config.xml"/>--><property name="mapperLocations" value="classpath:com/sun/mapper/*.xml"/></bean><!--SqlSessionTemplate:就是我们使用的sqlSession,这个是spring提供的--><bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"><!--我们只能使用构造器注入,因为没有set方法--><constructor-arg name="sqlSessionFactory" ref="sqlSessionFactory"/></bean><bean id="UserMapperImpl" class="com.sun.mapper.UserMapperImpl"><property name="sqlSessionTemplate" ref="sqlSessionTemplate"/></bean>
</beans>
 2.2.配置声明式事务
<!--配置声明式事务-->
<bean id="transationManage" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource"/>
</bean>
2.3.用AOP的方式实现事务
    <!--结合AOP实现事务的织入--><!--第一步:配置事务的通知--><tx:advice id="txAdvice" transaction-manager="transationManage"><tx:attributes><tx:method name="*" propagation="REQUIRED"/></tx:attributes></tx:advice>
2.4.配置事务切入
    <aop:config><aop:pointcut id="PointCut" expression="execution(* com.sun.mapper.*.*(..))"/><aop:advisor advice-ref="txAdvice" pointcut-ref="PointCut"/></aop:config>

http://www.khdw.cn/news/40738.html

相关文章:

  • wordpress 自动相册seo软件视频教程
  • wordpress 卡密关键词优化软件有哪些
  • 做pc端网站公司b站推广有用吗
  • 给客户做网站需要提供百度小说排行榜第一名
  • 手机域名网站怎么做怎么去推广自己的公司
  • 松江做公司网站谷歌paypal官网入口
  • 企业网站建设顾问宁波seo推广定制
  • 如何申请做网站windows优化大师有哪些功能
  • 网站url优化关键词优化报价
  • 做网站推广的一般都是什么公司搜索引擎排名优化是什么意思
  • 网站建设 是否计入固定资产地推团队接单平台
  • 成都大型网站建设公司焊工培训心得体会
  • 温州企业网站建设要多少钱广州网站运营
  • 网站建设的基本目标百度客服人工服务电话
  • 一学一做看视频网站有哪些seo排名策略
  • 模拟黑客网站推广互联网营销
  • 手机网站模板 怎样做seo搜索优化费用
  • 做我女朋友好不好手机网站上海网站seo
  • 金华关键词优化平台seo用什么论坛引流
  • 做牛仔裤的小视频网站seo关键词排名优化价格
  • 建网站数据库五八精准恶意点击软件
  • 郴州建设信息网站室内设计培训班学费一般多少
  • 网站系统 建设和软件岗位职责google框架一键安装
  • 汽车网站建设制作费用yandex搜索引擎
  • 完整的网站开发流程广州网站优化方式
  • 二手房网站平台怎么做360建网站
  • 不要钱做网站软件长春网站制作设计
  • 网站建设难学吗seo云优化软件破解版
  • 龙岗网站设计下载百度2024最新版
  • i5 7500网站开发免费ip地址代理