事务的传播属性

  1. 私有方法出错,事务回滚
    @Override
    @Transactional
    public void addContract() {
        ContractEntity contract = new ContractEntity();
        contract.setContractType(ContractTypeEnum.PURCHASE_CONTRACT);
        contract.setContractStatus(ContractStatusEnum.APPROVED);
        contract.setDealerCode(7000001);
        contract.setCreateBy("test01");
        contract.setCreateTime(LocalDateTime.now());
        contractDomain.save(contract);
        addQuotation();
    }

    private void addQuotation() {
        QuotationEntity quotationEntity = new QuotationEntity();
        quotationEntity.setDealerCode(7000320);
        quotationEntity.setCompanyCode("123");
        quotationEntity.setStatus(QuotationStatusEnum.NEW);
        quotationEntity.setQuotationType(STOCK_QUOTATION);
        quotationEntity.setExtraPrice(new BigDecimal("100"));
        quotationEntity.setCashDiscountPrice(new BigDecimal("100"));
        quotationEntity.setSaleTotalPrice(new BigDecimal("100"));
        quotationEntity.setCreateBy("test02");
        quotationEntity.setCreateTime(LocalDateTime.now());
        quotationDomain.save(quotationEntity);
    }
posted @ 2021-03-04 16:04  梦见舟  阅读(39)  评论(0编辑  收藏  举报