1 Star 0 Fork 1

汪少棠 / jpaTransactional

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
TVServiceExtImpl.java 1011 Bytes
一键复制 编辑 原始数据 按行查看 历史
package com.wmx.service.impl;
import com.wmx.repository.TVRepository;
import com.wmx.service.TVServiceExt;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* 电视业务层接口实现
*
* @author wangMaoXiong
* @version 1.0
* @date 2022/4/9 8:33
*/
@Service
public class TVServiceExtImpl implements TVServiceExt {
@Resource
private TVRepository tvRepository;
/**
* REQUIRES_NEW:表示新开一个事务,如果当前已经有事务,则会暂停
*
* @param id
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void deleteByIdExt(int id) {
boolean existsById = tvRepository.existsById(id);
if (existsById){
tvRepository.deleteById(id);
}
// System.out.println("123".split(",")[1]);
}
}
Java
1
https://gitee.com/wangmx1993/jpa-transactional.git
git@gitee.com:wangmx1993/jpa-transactional.git
wangmx1993
jpa-transactional
jpaTransactional
master

搜索帮助