leonardo 2015-10-19 18:54:56 +00:00
parent c52422052f
commit 72aad6e8c8
4 changed files with 6 additions and 6 deletions

View File

@ -4,5 +4,5 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa;
public interface SeguradoraEmpresaDAO extends GenericDAO<SeguradoraEmpresa, Integer> { public interface SeguradoraEmpresaDAO extends GenericDAO<SeguradoraEmpresa, Integer> {
public boolean existe(Empresa empresa); public boolean existe(Empresa empresa, String serie);
} }

View File

@ -28,11 +28,11 @@ public class SeguradoraEmpresaHibernateDAO extends GenericHibernateDAO<Segurador
return c.list(); return c.list();
} }
public boolean existe(Empresa empresa){ public boolean existe(Empresa empresa, String serie){
Criteria c = makeCriteria(); Criteria c = makeCriteria();
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("empresa", empresa)); c.add(Restrictions.eq("empresa", empresa));
c.add(Restrictions.eq("serie", serie));
return !c.list().isEmpty(); return !c.list().isEmpty();
} }
} }

View File

@ -4,6 +4,6 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa;
public interface SeguradoraEmpresaService extends GenericService<SeguradoraEmpresa, Integer>{ public interface SeguradoraEmpresaService extends GenericService<SeguradoraEmpresa, Integer>{
public boolean existe(Empresa empresa); public boolean existe(Empresa empresa, String serie);
} }

View File

@ -27,8 +27,8 @@ public class SeguradoraEmpresaServiceImpl implements SeguradoraEmpresaService {
return seguradoraEmpresaDAO.obtenerID(id); return seguradoraEmpresaDAO.obtenerID(id);
} }
public boolean existe(Empresa empresa){ public boolean existe(Empresa empresa, String serie){
return seguradoraEmpresaDAO.existe(empresa); return seguradoraEmpresaDAO.existe(empresa, serie);
} }
@Transactional @Transactional