Possuo um método que retorna uma lista de objetos.O que é melhor a ser feito:calcular o campo que preciso(PROGRESSO) no Java ou trazer na consulta SQL. Progresso é um valor que se altera conforme os dados cadastrados,não é uma coluna e irá determinar status. No momento estou calculando pela consulta,mas qual seria melhor pra performance?
String sql = "select s.ID_GARANTIA,s.CODGARANTIA,s.NOTAFISCAL,s.CLIENTE,s.DTPRAZO,s.ID_USER,s.SEGMENTO,s.DTCONCL,round((fin/tot)*100,2)as progr from (select t1.ID_GARANTIA,t1.CODGARANTIA,t1.NOTAFISCAL,t1.CLIENTE,t1.DTPRAZO,t1.ID_USER,t1.SEGMENTO,t1.DTCONCL,\n"
+ "sum(t1.qtdAut+t1.qtdLb+t1.qtdInf) as tot,coalesce(t4.fin,0)as fin from(select g.ID_GARANTIA,g.CODGARANTIA,g.NOTAFISCAL,g.CLIENTE,g.DTPRAZO,g.ID_USER,g.SEGMENTO,g.DTCONCL,\n"
+ "count(ia.ID_GAR)AS qtdAut, count(lb.ID_GAR) AS qtdLb,count(inf.ID_GAR)AS qtdInf\n"
+ "from garantias as g\n"
+ "left join itens_automotivo as ia on g.ID_GARANTIA=ia.ID_GAR\n"
+ "left join itens_linhabranca as lb on g.ID_GARANTIA=lb.ID_GAR\n"
+ "left join itens_informatica as inf on g.ID_GARANTIA=inf.ID_GAR\n"
+ "group by g.ID_GARANTIA order by g.ID_GARANTIA)as t1\n"
+ "left join\n"
+ "(select t3.ID_GARANTIA,sum(t3.finAut+t3.finLb+t3.finInf)as fin from(select ID_GARANTIA,count(ia.ID_GAR)AS finAut,count(lb.ID_GAR)AS finLb,count(inf.ID_GAR)AS finInf from garantias as g \n"
+ "left join itens_automotivo as ia on g.ID_GARANTIA=ia.ID_GAR\n"
+ "left join itens_linhabranca as lb on g.ID_GARANTIA=lb.ID_GAR\n"
+ "left join itens_informatica as inf on g.ID_GARANTIA=inf.ID_GAR where ia.LAUDO=1 or lb.LAUDO=1 or inf.LAUDO=1\n"
+ "group by g.ID_GARANTIA order by g.ID_GARANTIA) as t3 group by t3.ID_GARANTIA order by t3.ID_GARANTIA)as t4 on t1.ID_GARANTIA=t4.ID_GARANTIA\n"
+ "where t1.ID_GARANTIA";