zoukankan      html  css  js  c++  java
  • 检查时异常和运行是异常 + 事务回滚 +隔离级别

      检查时异常checked Exception 是编译检查时候就能发现的异常。这个能在try catch中处理,就在try catch 中处理。

      运行时异常(Runtime Exception),是程序遇到了问题,需要停下。这个不用try catch 处理,因为遇到这个程序就停下了。。。。。。 

      spring框架中能默认回滚的异常时 Runtime Exception.

      需要在方法上添加 
    @Transactional(rollbackFor={Exception.class})

    此文为笔记

    参考链接:https://blog.csdn.net/qq_34406670/article/details/78945955

      https://blog.csdn.net/qq_18505715/article/details/76696439

    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}, isolation = Isolation.DEFAULT, readOnly = false) 

     上面的 propagation = Propagation.REQUIRED是指的是事务的创建方式。

      isolation = Isolation.DEFAULT  是指的是数据库中事务的隔离级别 (只是暂时这样,理解)。

    参考文章:https://blog.csdn.net/fight_man8866/article/details/81297929

  • 相关阅读:
    (一〇八)iPad开发之横竖屏适配
    ZOJ 1414:Number Steps
    HDU 1391:Number Steps
    ZOJ 1871:Steps
    POJ 2590:Steps
    POJ 2629:Common permutation
    POJ 2562:Primary Arithmetic
    POJ 2505:A multiplication game
    HDU 1517:A Multiplication Game
    POJ 3650:The Seven Percent Solution
  • 原文地址:https://www.cnblogs.com/prader6/p/10899550.html
Copyright © 2011-2022 走看看