package com.oguerreiro.resilient.repository.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.oguerreiro.resilient.domain.OutputData;
import com.oguerreiro.resilient.repository.OutputDataRepositoryExtended;

import jakarta.persistence.EntityManager;

@Repository
public class OutputDataRepositoryExtendedImpl implements OutputDataRepositoryExtended {
  @Autowired
  private EntityManager entityManager;

  @Override
  @Transactional(propagation = Propagation.REQUIRES_NEW)
  public void saveInNewTransaction(OutputData outputData) {
    // Persist the entity in a new transaction
    entityManager.persist(outputData);
  }

}
