/*
|
* 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;
|
|
import com.megatim.apifdxweb.dao.ifaces.referentiel.ApplicationSourceDAO;
|
import com.megatim.fdxcommons.model.referentiel.ApplicationSource;
|
import java.util.List;
|
import javax.ejb.Stateless;
|
import javax.persistence.EntityManager;
|
import javax.persistence.PersistenceContext;
|
import javax.persistence.Query;
|
|
/**
|
*
|
* @author ASUS
|
*/
|
@Stateless
|
public class ApplicationSourceDAOImpl implements ApplicationSourceDAO {
|
|
@PersistenceContext(unitName = "fdxPU")
|
protected EntityManager em;
|
|
public ApplicationSourceDAOImpl() {
|
}
|
|
@Override
|
public EntityManager getEntityManager() {
|
return em;
|
}
|
|
@Override
|
public Class<ApplicationSource> getManagedEntityClass() {
|
return (ApplicationSource.class);
|
}
|
|
@Override
|
public ApplicationSource getById(String id) {
|
Query query = getEntityManager().createQuery("SELECT a FROM ApplicationSource a where a.libelle = :id");
|
query.setParameter("id", id);
|
|
List<ApplicationSource> liste = query.getResultList();
|
|
return liste != null ? liste.stream().findFirst().get() : null;
|
}
|
}
|