예제 #1
0
 @Override
 public Integer insert(String name) {
   Demo demo = new Demo();
   demo.setName(name);
   if (this.demoDao.insert(demo)) {
     return demo.getId();
   }
   return 0;
 }
예제 #2
0
 private void txUpdate() {
   Demo demo = new Demo();
   demo.setName("事务操作插入2");
   this.demoDao.insert(demo);
   if (true) {
     throw new RuntimeException("事务跑出运行期异常");
   }
   Demo demo1 = new Demo();
   demo1.setName("事务操作插入3");
   this.demoDao.insert(demo1);
 }
예제 #3
0
 @Override
 public void tpTxUpdate(DemoType dt) throws BusinessException {
   log.info("d");
   boolean b = this.demoDao.update(9, "", dt);
   log.info("dd");
   if (!b) {
     throw new BusinessException("name已更改");
   }
   Demo demo1 = new Demo();
   demo1.setName("事务操作插入3");
   this.demoDao.insert(demo1);
 }
예제 #4
0
 @Override
 public void txUpdate(Integer sign, DemoType dt, DataSourceEnum ds) throws BusinessException {
   log.info("d");
   boolean b = this.demoDao.update(8, "事务操作修改" + sign, dt);
   log.info("dd");
   if (!b) {
     throw new BusinessException("事务抛出业务异常");
   }
   if (sign == 1) {
     throw new BusinessException("事务抛出业务异常");
   }
   if (sign == 2) {
     throw new RuntimeException("事务抛出运行期异常");
   }
   Demo demo = new Demo();
   demo.setName("事务操作插入" + sign);
   this.demoDao.insert(demo);
 }