I am using loopback 4. When I execute the commit, in different situations the connection is closed, if i execute the query without transaction it is fine, it inserts the record quietly. it often happens to me when I run a query multiple times within a foreach. Could you please tell me how to solve? I report below an example of a commit
const repo = new DefaultTransactionalRepository(oggetto, this.classerepository.dataSource);
const tx = await repo.beginTransaction();
try {
this.repository.create(oggetto, {transaction: tx});
this.other_repository.create(oggetto2, {transaction: tx});
tx.commit();
} catch (e) {
tx.rollback();
}