41 lines
1.5 KiB
Plaintext
Executable File
41 lines
1.5 KiB
Plaintext
Executable File
package com.fp.armas.portal.dao.registro;
|
|
|
|
import java.util.List;
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
import javax.persistence.criteria.Root;
|
|
|
|
import com.fp.armas.portal.dao.general.GenericDaoImpl;
|
|
import com.fp.armas.portal.model.Tcustpersondetail;
|
|
import com.fp.armas.portal.util.FechaUtil;
|
|
import com.fp.armas.portal.util.RegistroException;
|
|
|
|
/**
|
|
* Objeto de acceso a datos de la tabla {@link Tcustpersondetail}
|
|
*/
|
|
public class PersonaDetalleDao extends GenericDaoImpl<Tcustpersondetail> {
|
|
|
|
|
|
public PersonaDetalleDao() {
|
|
super(Tcustpersondetail.class);
|
|
}
|
|
|
|
public Tcustpersondetail buscarPorIdentificacion(String codigoIdentificacion) throws RegistroException {
|
|
try {
|
|
Tcustpersondetail detallePersona = null;
|
|
CriteriaBuilder cb = this.getEntityManager().getCriteriaBuilder();
|
|
CriteriaQuery<Tcustpersondetail> query = cb.createQuery(Tcustpersondetail.class);
|
|
Root<Tcustpersondetail> personDetailRoot = query.from(Tcustpersondetail.class);
|
|
query.where(cb.equal(personDetailRoot.get("identification"), codigoIdentificacion),cb.equal(personDetailRoot.get("id").get("dateto"), FechaUtil.obtenerFecha(2999, 11, 31)));
|
|
List<Tcustpersondetail> detallesPersona = this.getEntityManager().createQuery(query).getResultList();
|
|
if(!detallesPersona.isEmpty()){
|
|
detallePersona = detallesPersona.get(0);
|
|
}
|
|
return detallePersona;
|
|
} catch (Throwable e) {
|
|
throw new RegistroException(e);
|
|
}
|
|
}
|
|
}
|