julio 2016-12-29 17:05:59 +00:00
parent 8da406f4c1
commit 17996c26f4
3 changed files with 39 additions and 32 deletions

View File

@ -8,6 +8,7 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
@ -133,14 +134,20 @@ public class AidfHibernateDAO extends GenericHibernateDAO<Aidf, Long> implements
@Override
public List<Aidf> buscaAidfRMD(Integer empresaId, Integer estadoId) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("estado.estadoId", estadoId));
c.add(Restrictions.eq("empresa.empresaId", empresaId));
// c.add(Restrictions.eq("aidfEspecie.decespecie", "RMD"));
StringBuilder sb = new StringBuilder();
sb.append(" from Aidf ");
sb.append(" where activo = :activo ");
sb.append(" and estado.estadoId = :estadoId ");
sb.append(" and empresa.empresaId = :empresaId ");
sb.append(" and aidfEspecie.decespecie = 'RMD' ");
return (List<Aidf>) c.list();
Query query = getSession().createQuery(sb.toString());
query.setBoolean("activo", Boolean.TRUE);
query.setInteger("estadoId", estadoId);
query.setInteger("empresaId", empresaId);
return (List<Aidf>) query.list();
}
}

View File

@ -24,10 +24,8 @@ import org.hibernate.annotations.GenericGenerator;
@Table(name = "AIDF")
public class Aidf implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Long aidfId;
private AidfTipo aidfTipo;
private AidfEspecie aidfEspecie;

View File

@ -18,6 +18,8 @@ import javax.persistence.TemporalType;
@Table(name = "AIDF_ESPECIE")
public class AidfEspecie implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private Integer aidfespId;
private String decespecie;
private Boolean activo;
@ -30,32 +32,32 @@ public class AidfEspecie implements java.io.Serializable {
public AidfEspecie(Integer aidfespId) {
this.aidfespId = aidfespId;
}
@Override
public String toString() {
public String toString() {
return decespecie;
}
@Override
public int hashCode() {
int hash = 0;
hash += (aidfespId != null ? aidfespId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AidfEspecie))
return false;
AidfEspecie other = (AidfEspecie) object;
if ((this.aidfespId == null && other.aidfespId != null) || (this.aidfespId != null && !this.aidfespId.equals(other.aidfespId))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 0;
hash += (aidfespId != null ? aidfespId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AidfEspecie))
return false;
AidfEspecie other = (AidfEspecie) object;
if ((this.aidfespId == null && other.aidfespId != null) || (this.aidfespId != null && !this.aidfespId.equals(other.aidfespId))) {
return false;
}
return true;
}
public AidfEspecie(Integer aidfespId, String decespecie, Boolean activo, Date fecmodif, Integer usuarioId) {
this.aidfespId = aidfespId;
this.decespecie = decespecie;