shouldAddCount = true;
} else {
con = dataSource.getConnection();
}
} else { // 第一次开始事务
JdbcTransactionManager txManager = (JdbcTransactionManager) txObject.getTxManager();
if (distribute) {// 分布式数据源,只在第一此写操作时启动事务
if (needBeginTransaction()) {
beginNewTransaction(dataSource, txObject);
con = txObject.getConnectionHolder().getCurrentConnection();
shouldAddCount = true;
} else {// 创建独立于事务之外的connection
con = dataSource.getConnection();
}
} else if (txManager.isLazyBegin()) {// 仅懒启动式事务,第一次启动事务
beginNewTransaction(dataSource, txObject);
con = txObject.getConnectionHolder().getCurrentConnection();
shouldAddCount = true;
} else {
throw new TransactionException("not lazyBegin transaction bu no currentConnection exist");