首页 \ 问答 \ Spring事务:在Exception或Throwable上回滚(Spring transaction: rollback on Exception or Throwable)

Spring事务:在Exception或Throwable上回滚(Spring transaction: rollback on Exception or Throwable)

我想知道是否有意义使用,而不是

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)

使用Throwable

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)

正如我理解的那样,即使发生了一些非常糟糕的情况, Error也会帮助我们正确行事。 或者,也许它不会帮助?


I wonder whether it makes sense to use instead of

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)

to use Throwable

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)

As I understand catching Error will help us behave correctly even when something really bad happen. Or maybe it wouldn't help?


原文:https://stackoverflow.com/questions/21188239
更新时间:2023-05-15 07:05

最满意答案

这是解决方案,可能对其他人有帮助。

    $(function () {
       DoJobOne();
       DoJObTwo();
   });

   function pageLoad(sender, args) {
       if (args.get_isPartialLoad()) {
           DoJobOne();
           DoJObTwo();
       }

   }

Here is the solution, might be helpful for others.

    $(function () {
       DoJobOne();
       DoJObTwo();
   });

   function pageLoad(sender, args) {
       if (args.get_isPartialLoad()) {
           DoJobOne();
           DoJObTwo();
       }

   }

相关问答

更多
  • 可能是web.config以某种方式被改变了吗? 你能验证web.config文件中是否存在这样的东西吗? 如果没有,这可能会导致您得到的错误.. Can it be that the web.config somehow has been changed? Can yo ...
  • 确保你在页面上有一个Scriptmanager,脚本在Scriptmanager下面。 也许尝试将脚本标记放入正文并查看会发生什么。 我不知道如何解决它不在体内的问题,但是在加载时可能会发生Sys回调 你不需要括号来告诉哪个函数是需要的: Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onUpdated); Ensure you have a Scriptmanager on the page and the script is ...
  • 这是解决方案,可能对其他人有帮助。 $(function () { DoJobOne(); DoJObTwo(); }); function pageLoad(sender, args) { if (args.get_isPartialLoad()) { DoJobOne(); DoJObTwo(); } } Here is the solution, might be hel ...
  • 根本问题是iPad全屏应用程序提供ASP.Net无法识别的用户代理标头,因此它认为浏览器不支持ajax。 这导致ScriptManager不包括“MicrosoftAjaxWebForms.js”以及与ajax面板无关的所有其他相关内容。 您可能需要将以下hack添加到您的基页以解决此问题: protected void Page_PreInit(object sender, EventArgs e) { if (Request.UserAgent != null && Request.UserAge ...
  • 我想不是,你可以使用这个: var prm1 = Sys.WebForms.PageRequestManager.getInstance(); if (!prm1.get_isInAsyncPostBack()) { prm1.add_initializeRequest(InitializeRequest); } var prm2 = Sys.WebForms.PageRequestManager.getInstance(); if (!prm2.get_isInAsyncPostBack()) ...
  • 好的,我发现了我需要做的事情。 因为回发事件参数总是存储在名为“__EVENTARGUMENT”的隐藏标记中,所以我们可以简单地访问: var postbackArgument = document.getElementById('__EVENTARGUMENT'); if (postbackArgument) if (postbackArguments.value == 'Objects') { // Do stuff here } 我不确定是否在触发initializeRequest AJAX事件时 ...
  • 确保在页面上包含asp.net-ajax脚本管理器控件。 更新: 来自评论: 但是一个不使用Ajax或与scriptmanager相关的任何页面都会导致此错误。 错误。 scriptmanager控件会在渲染的html页面中包含一堆javascript( -ed)。 如果没有该scriptmanager控件,此javascript将无法使用。 在链接的javascript中,您的错误是抱怨的Sys对象。 获得Sys is undefined的唯一方法Sys is undefined错误, ...
  • 事实证明,51degrees.mobi高级设备数据文件是罪魁祸首。 删除文件,从而不从中加载定义,解决了这个问题。 看起来我们的版本没有很好地处理firefox 14.0.1用户代理字符串。 As it turns out, 51degrees.mobi premium device data file was the culprit. Deleting the file, thus not loading definitions from it, solves this problem. It looks ...
  • 好的,没关系,我明白了。 如果其他人遇到此问题,请将sys.webforms .....行放入如下: $(document).ready( function () { sys.webforms....; } ok, nevermind, I got it. If someone else runs into this problem, put the sys.webforms..... line like this: $(document).ready( function () { sys.webform ...
  • 尝试这个