title: Does TypeORM provide transactions for different repositories?
body: <p>Currently, three different repositories have something to deal with as a single transaction.</p>
  <p>My service code is written as follows. But unlike what I thought, each repository is generating its own transaction. How can I solve this problem?</p>
  <pre class="lang-js prettyprint-override"><code>// TrimService
  
  @Injectable()
  export class TrimService {
      constructor(
          private readonly trimRepository: TrimRepository,
          private readonly tireRepository: TireRepository,
          private readonly userRepository: UserRepository
      ) {}
  
      async saveUserTrim(saveUserTrimDto: SaveUserTrimDto, res) {
          const queryRunner = await getConnection().createQueryRunner();
          await queryRunner.startTransaction();
  
          try {
              const findUser: User = await this.userRepository.findUser(
                  saveUserTrimDto.id,
                  queryRunner.manager
              );
  
              const createTrim: Trim = await this.trimRepository.saveUserTrim(
                  findUser,
                  saveUserTrimDto.trimId,
                  queryRunner.manager
              );
  
              await this.tireRepository.saveTrimTire(
                  createTrim,
                  res,
                  queryRunner.manager
              );
  
              await queryRunner.commitTransaction();
              return createTrim;
          } catch (err) {
              console.log(err);
              await queryRunner.rollbackTransaction();
          } finally {
              await queryRunner.release();
          }
      }
  }
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>// userRepository
  
  @EntityRepository(User)
  export class UserRepository extends Repository&lt;User&gt; {
      async findUser(
          id: string,
          @TransactionManager() transactionManager?: EntityManager
      ) {
          const findUser = await this.findOne({ id: id });
  
          if (!findUser) {
              throw new NotFoundUserException();
          }
  
          return findUser;
      }
  }
  </code></pre>