bug #8121
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@64307 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
8da406f4c1
commit
17996c26f4
|
@ -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));
|
||||
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' ");
|
||||
|
||||
// c.add(Restrictions.eq("aidfEspecie.decespecie", "RMD"));
|
||||
Query query = getSession().createQuery(sb.toString());
|
||||
|
||||
return (List<Aidf>) c.list();
|
||||
query.setBoolean("activo", Boolean.TRUE);
|
||||
query.setInteger("estadoId", estadoId);
|
||||
query.setInteger("empresaId", empresaId);
|
||||
|
||||
return (List<Aidf>) query.list();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -37,24 +39,24 @@ public class AidfEspecie implements java.io.Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (aidfespId != null ? aidfespId.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
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;
|
||||
@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;
|
||||
}
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue