/*
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
*/
|
package com.megatim.apifdxweb.dao.impl.referentiel.historique;
|
|
import com.megatim.fdxcommons.dao.ifaces.referentiel.historique.ReferentielIntegrationHistoriqueDAO;
|
import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistorique;
|
import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistoriqueId;
|
import java.util.Optional;
|
import javax.ejb.Stateless;
|
import javax.persistence.EntityManager;
|
import javax.persistence.PersistenceContext;
|
|
/**
|
*
|
* @author ASUS
|
*/
|
@Stateless
|
public class ReferentielIntegrationHistoriqueDAOImpl implements ReferentielIntegrationHistoriqueDAO {
|
|
@PersistenceContext(name = "fdxPU")
|
protected EntityManager em;
|
|
@Override
|
public Class<ReferentielIntegrationHistorique> getManagedEntityClass() {
|
return ReferentielIntegrationHistorique.class;
|
}
|
|
@Override
|
public EntityManager getEntityManager() {
|
return em;
|
}
|
|
@Override
|
public ReferentielIntegrationHistorique getById(ReferentielIntegrationHistoriqueId id) {
|
Optional<ReferentielIntegrationHistorique> optRefInt = em
|
.createQuery("SELECT r from ReferentielIntegrationHistorique r where r.codeTypeFichier = :codeTypeFichier AND r.referentielVersion = :refVersion")
|
.getResultList()
|
.stream()
|
.findFirst();
|
|
return optRefInt.isPresent() ? optRefInt.get() : null;
|
}
|
|
}
|