code: private TenantMetaData createInitialTenantMetaData(final String tenant) {
          return systemSecurityContext.runAsSystemAsTenant(
                  () -> DeploymentHelper.runInNewTransaction(txManager, "initial-tenant-creation", status -> {
                      final DistributionSetType defaultDsType = createStandardSoftwareDataSetup();
                      return tenantMetaDataRepository.save(new JpaTenantMetaData(defaultDsType, tenant));
                  }), tenant);
      }
docs: Creating the initial tenant meta-data in a new transaction. Due the
  {@link MultiTenantJpaTransactionManager} is using the current tenant to
  set the necessary tenant discriminator to the query. This is not working
  if we don't have a current tenant set. Due the
  {@link #getTenantMetadata(String)} is maybe called without having a
  current tenant we need to re-open a new transaction so the
  {@link MultiTenantJpaTransactionManager} is called again and set the
  tenant for this transaction.
  
  @param tenant
  the tenant to be created
  @return the initial created {@link TenantMetaData}