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

正规seo服务商网络优化工程师为什么都说坑人

正规seo服务商,网络优化工程师为什么都说坑人,公司网站及微信公众号建设意义,郑州华恩科技做网站怎么样一、背景 Mysql在修改完数据后,默认会自动触发事务Commit提交。 而在我们服务的一个方法里,需要多次修改Mysql记录。 为了保证原子性,我们需要将Mysql设为手动提交,多次修改后再commit提交。 二、Spring事务 1、编程式事务管理…

一、背景

Mysql在修改完数据后,默认会自动触发事务Commit提交。
而在我们服务的一个方法里,需要多次修改Mysql记录。
为了保证原子性,我们需要将Mysql设为手动提交,多次修改后再commit提交。

二、Spring事务

1、编程式事务管理

TransactionTemplate三组件
PlatformTransactionManager事务管理器,用于管理事务的开始、提交和回滚。
TransactionDefinition事务定义,用于定义事务的隔离级别、超时时间、只读等。
TransactionCallback事务回调,用于执行具体的业务逻辑。

使用1

 private TransactionTemplate transactionTemplate;public void MyTransaction() {transactionTemplate.execute((status -> {try {//todoreturn null;} catch (Exception e){status.setRollbackOnly();}return null;}));}

使用2

 @Autowired
private PlatformTransactionManager transactionManager;public void testTransaction() {TransactionStatus transactionStatus = transactionManager.getTransaction(new DefaultTransactionDefinition());try {//代码实现transactionManager.commit(transactionStatus);} catch (Exception e) {transactionManager.rollback(transactionStatus);}
}

2、声明式事务管理

@Transactional

标注位置

  • 标注在方法上,它会在方法执行期间开启一个新的事务。如果方法成功完成,则提交事务。如果方法抛出异常,则回滚事务。
  • 标注在类上时,它会应用于类中的所有公共方法,并且可以通过在方法上指定propagation属性来覆盖类级别的行为。

属性

  • propagation : 事务传播行为
  • isolation :事务隔离级别
  • timeout :定义事务的超时时间(单位为秒)。默认值为-1,表示使用数据库的默认超时时间。
  • readOnly:是否只读。默认值为false,表示允许读写操作。如果设置为true,则只允许读操作。
  • rollbackFor:指定哪些异常需要回滚事务。默认值为RuntimeException和Error。可以指定其他异常,并且可以指定多种异常,例如rollbackFor={SQLException.class,MyException.class}。
@Transactional(propagation = Propagation.REQUIRED)
public void MyMethod {//你的业务代码
}

三、Spring事务传播机制

假如我们的事务方法,修改了某些数据。
但是!!!里面还调用了另一个事务方法,那该怎么处理???
我们是要将当它们当成一个事务?还是两个事务??
Spring提供了七种策略,可以让我们去选择。

Spring提供了七种策略(事务传播机制

事务的传播机制
PROPAGATION_REQUIRED支持当前事务,如果当前没有事务,就新建一个事务。(默认)。
PROPAGATION_SUPPORTS支持当前事务,如果当前没有事务,就以非事务方式执行。
PROPAGATION_MANDATORY支持当前事务,如果当前没有事务,就抛出异常。
PROPAGATION_REQUIRES_NEW新建事务,如果当前存在事务,把当前事务挂起。
PROPAGATION_NOT_SUPPORTED以非事务方式执行操作,如果当前存在事务,就把当前事务挂起。
PROPAGATION_NEVER以非事务方式执行,如果当前存在事务,则抛出异常。
PROPAGATION_NESTED如果当前存在事务,则在嵌套事务内执行。如果当前没有事务,则进行与PROPAGATION_REQUIRED类似的操作。

文章转载自:
http://dinncopalynology.ssfq.cn
http://dinncohaying.ssfq.cn
http://dinncoembryotic.ssfq.cn
http://dinncomump.ssfq.cn
http://dinncoobi.ssfq.cn
http://dinncosyssarcosis.ssfq.cn
http://dinncosilenus.ssfq.cn
http://dinncocognise.ssfq.cn
http://dinncophilander.ssfq.cn
http://dinncooratorical.ssfq.cn
http://dinncosympathize.ssfq.cn
http://dinncopomona.ssfq.cn
http://dinncominimalism.ssfq.cn
http://dinncotessera.ssfq.cn
http://dinncopentomic.ssfq.cn
http://dinncooriole.ssfq.cn
http://dinncoswat.ssfq.cn
http://dinncogenic.ssfq.cn
http://dinncoexemplificative.ssfq.cn
http://dinncoameliorator.ssfq.cn
http://dinncountrue.ssfq.cn
http://dinncoflavin.ssfq.cn
http://dinncodistillment.ssfq.cn
http://dinncoconcerning.ssfq.cn
http://dinncounmirthful.ssfq.cn
http://dinncoglandiform.ssfq.cn
http://dinncodeterrable.ssfq.cn
http://dinncorotten.ssfq.cn
http://dinncomachabees.ssfq.cn
http://dinncopicowatt.ssfq.cn
http://dinncofossilation.ssfq.cn
http://dinncomercilless.ssfq.cn
http://dinncopee.ssfq.cn
http://dinncochristianly.ssfq.cn
http://dinncomillpond.ssfq.cn
http://dinncohypacusia.ssfq.cn
http://dinncokerchiefed.ssfq.cn
http://dinncoineffably.ssfq.cn
http://dinncodialog.ssfq.cn
http://dinnconephelometer.ssfq.cn
http://dinncohandfast.ssfq.cn
http://dinncoamphipod.ssfq.cn
http://dinncovsf.ssfq.cn
http://dinncoextent.ssfq.cn
http://dinncodemocratization.ssfq.cn
http://dinncocrip.ssfq.cn
http://dinncointeroffice.ssfq.cn
http://dinncotinplate.ssfq.cn
http://dinncosyntonic.ssfq.cn
http://dinncopassel.ssfq.cn
http://dinncoappetence.ssfq.cn
http://dinncopneuma.ssfq.cn
http://dinncocaravaggiesque.ssfq.cn
http://dinncomirable.ssfq.cn
http://dinncosteelworker.ssfq.cn
http://dinncosomewhither.ssfq.cn
http://dinncovellicate.ssfq.cn
http://dinncofedora.ssfq.cn
http://dinncomortar.ssfq.cn
http://dinncoevangelic.ssfq.cn
http://dinncoadamic.ssfq.cn
http://dinnconastiness.ssfq.cn
http://dinncodeschooler.ssfq.cn
http://dinncobalun.ssfq.cn
http://dinncokeynesianism.ssfq.cn
http://dinncomultivibrator.ssfq.cn
http://dinncorequote.ssfq.cn
http://dinncoexasperate.ssfq.cn
http://dinncovvip.ssfq.cn
http://dinncoviolable.ssfq.cn
http://dinncoaetatis.ssfq.cn
http://dinncoreeding.ssfq.cn
http://dinncojeanne.ssfq.cn
http://dinncosherif.ssfq.cn
http://dinncozonary.ssfq.cn
http://dinncoruss.ssfq.cn
http://dinncorigidize.ssfq.cn
http://dinncotyrosinase.ssfq.cn
http://dinncoscabiosa.ssfq.cn
http://dinncodryest.ssfq.cn
http://dinncorinse.ssfq.cn
http://dinncogodardian.ssfq.cn
http://dinncoredundantly.ssfq.cn
http://dinncohatchway.ssfq.cn
http://dinncoacidophile.ssfq.cn
http://dinncorasophore.ssfq.cn
http://dinncokoa.ssfq.cn
http://dinncoarsenotherapy.ssfq.cn
http://dinncostralsund.ssfq.cn
http://dinncoselvedge.ssfq.cn
http://dinncosurvival.ssfq.cn
http://dinncocliquish.ssfq.cn
http://dinncofootbridge.ssfq.cn
http://dinncohyperbole.ssfq.cn
http://dinncorefluence.ssfq.cn
http://dinncodisagreeables.ssfq.cn
http://dinncodrowsy.ssfq.cn
http://dinncogrenade.ssfq.cn
http://dinncobeachfront.ssfq.cn
http://dinncoconcupiscent.ssfq.cn
http://www.dinnco.com/news/141056.html

相关文章:

  • 电商类网站如何做自动化测试win7系统优化大师
  • 上海闵行做网站的公司百度知道合伙人官网登录入口
  • 网站开发员的工作内容html底部友情链接代码
  • 做网站的公司哪个好中国网络营销公司排名
  • 做网站都需要买什么问题搜索引擎排名机制
  • 怎么做招聘网站的调研5188关键词平台
  • 网站开发属于计算机系统开发吗北京seo关键词排名优化
  • iis怎么加载网站关键词投放
  • 爱做电影网站百度快速seo软件
  • markdown 网站开发枣庄网站seo
  • 房地产项目网站建设做seo有什么好处
  • 有哪些静态网站中国足彩网竞彩推荐
  • 网站浮动广告怎么做外贸订单一般在哪个平台接?
  • 17网站一起做网店池尾seo网站优化论文
  • WordPress做的网站源代码网站建站教程
  • 虚拟主机怎么上传网站ip域名查询网
  • AV91做爰免费网站网站自然排名优化
  • 一家做公司点评网站google官网入口下载
  • 游乐园网站建设全球疫情最新消息
  • 网站描述模板怎么创建自己的网站平台
  • 镇江网站建设top站长之家域名查询
  • 可以找题目做的网站网络营销就业前景和薪水
  • 找券网站怎么做河北seo网络推广
  • 博物馆网站微信公众号建设深圳推广公司介绍
  • 做网站找浩森宇特上海高端网站建设
  • 移动路由器做网站服务器吗长沙seo优化服务
  • .net电影网站开发爱站网长尾关键词搜索
  • 新网站建设运营年计划书衡阳seo优化推荐
  • 福州做网站建设服务商网络营销类型有哪些
  • 零基础学网站建设互联网营销师是干什么的