the container will not automatically roll back a transaction on a checked exception when you use the declarative transaction model.
在使用declarativetransaction模型时,容器将不会针对检测到的异常自动回滚事务。
the answer, surprisingly, is that upon a checked exception (either in the spring framework or ejb), the transaction commits any work that has not yet been committed.
答案出乎意料:根据受控异常(不管是在springframework 中还是在ejb 中),事务会提交它还未提交的所有工作。
additionally, the checked exception hierarchy is bad designed, for example, if you do something with reflection, you have to catch 4 or 5 separate exceptions.
此外,检查的异常层次结构是糟糕的设计,例如,如果你与反射做某事,你必须抓住4个或5个独立的例外。
using listing 13, this means that if a checked exception occurs during the updateacct() method, the trade order is persisted, but the account isn「t updated to reflect the trade.
使用清单13,这意味着,如果在执行updateacct()方法期间抛出受控异常,就会保存交易订单,但不会更新帐户来反映交易情况。
well, all the urls we」ll be using are going to be hard coded, so we'll wrap the creation of the url in some utility code to turn the checked exception into a runtime exception.
所有将使用的url都会是硬编码的。所以我们会使用一些辅助代码来包装它的创建过程。这样就可以把受检查的异常转换为一个运行时异常。(注:编译器会强制要求处理受检查的异常,而运行时异常却不会有这个要求。)
one way to handle this is to provide a public static initialize() method that throws a checked exception when initialization fails.
处理这个问题的一种方法是提供一个公共静态initialize()方法,初始化失败时该方法将抛出一个检查到的异常。
this checked exception -- the only one defined by the scripting package -- indicates that the engine failed to parse or execute the given code.
这个选中的异常(脚本包中定义的惟一一个异常)表示引擎无法解析或执行给定的代码。