事务02-事务案例-转账:不使用Spring事务管理的实现(Spring 笔记012)

1.新建account表
2.导入jar包
{ 核 心 与 依 赖 : 4 + 1 a o p ( a o p 联 盟 , s p r i n g    a o p , a s p e c t 规 范 , s p r i n g    a s p e c t ) 数 据 库 : j d b c + t x + 数 据 库 驱 动 包 / 连 接 池    + c s p o \left\{\begin{array}{l}\mathrm{核心与依赖}:4+1\\aop(aop\mathrm{联盟},spring\;aop,aspect\mathrm{规范},spring\;aspect)\\\mathrm{数据库}:jdbc+tx+\mathrm{数据库驱动包}/\mathrm{连接池}\;+cspo\\\end{array}\right. 4+1aop(aopspringaop,aspectspringaspect)jdbc+tx+/+cspo
3.转账事务管理类

在这里插入图片描述

public class AccountServiceImpl implements AccountService{
private accountDao accountdao;
public void setAccountDao (AccountDao accountDao){
  rhis.accountDao=accountDao;}
public void transfer(String outer,String inner ,Integer money) {
accountDao.out(outer,money);
int i=1/0;//断电
accountDao.in(inner,money);
 }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值