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.InputData;
import com.oguerreiro.resilient.repository.InputDataRepositoryExtended;

import jakarta.persistence.EntityManager;

@Repository
public class InputDataRepositoryExtendedImpl implements InputDataRepositoryExtended {
    @Autowired
    private EntityManager entityManager;

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

}
