title: launch many transactions typeorm into loop javascript
body: <p><em>In my Electron App I would like to inject data (like Fixtures) when App launched.</em></p>
  
  <p>I use typeorm library for managing my SQLite3 Database connection.</p>
  
  <p>I created json file that represent Entity typeorm and I would like persist all of them in my DB with typeorm. For that It seems that use trasaction is more efficient.</p>
  
  <p>I try two differents things but the result is the same and I don't uderstand why. The issue message is : </p>
  
  <blockquote>
    <p>Error: Transaction already started for the given connection, commit
    current transaction before starting a new one</p>
  </blockquote>
  
  <p><strong>My first implementation of transaction</strong> : </p>
  
  <pre><code>async setAll(entity, data)
  {
      let connection = await this.init()
      const queryRunner = connection.createQueryRunner()
      await queryRunner.connect()
  
      for (const [key, value] of Object.entries(data))
      {
          await typeorm.getManager().transaction(transactionalEntityManager =&gt;
          {
  
          })
      }
  }
  </code></pre>
  
  <p><strong>My second implementation of transaction</strong> : </p>
  
  <pre><code>async setAll(entity, data)
  {
      let connection = await this.init()
      const queryRunner = connection.createQueryRunner()
      await queryRunner.connect()
  
      for (const [key, value] of Object.entries(data))
      {
          let genre1 = new Genre()
          genre1.name = 'toto'
          genre1.identifier = 'gt'
          genre1.logo = ''
          genre1.isActivate = false
  
          await queryRunner.startTransaction()
          await queryRunner.manager.save(genre1)
          await queryRunner.commitTransaction()
          await queryRunner.release()
      }
  }
  </code></pre>
  
  <p><em>NB : The second implementation persist correctly the first object but not the others.</em></p>
  
  <p><strong>How can manage many typeorm Transaction created into loop for persist lot of data ?</strong> </p>