grails hql um metodo que retone um Map
26/09/2014 18:11
public static Map listAtendimentos_TI(Long idRequisitante) throws Exception{
def atentimentos = Atendimento.executeQuery("SELECT DISTINCT ate_id,ate_abertura,ate_situacao_id " +
" FROM ate_atendimento " +
" where ate_requisitante_id = "+ idRequisitante +
" ORDER BY ate_abertura DESC LIMIT 5");
return atentimentos ;
}
Error |
2014-09-26 18:01:04,084 [http-bio-8443-exec-9] ERROR errors.GrailsExceptionResolver - QuerySyntaxException occurred when processing request: [GET] /portal/atendimento_ti/listarChamados - parameters:
_: 1411765263828
ate_atendimento is not mapped [SELECT DISTINCT ate_id,ate_abertura,ate_situacao_id FROM ate_atendimento where ate_requisitante_id = 2215785101 ORDER BY ate_abertura DESC LIMIT 5]. Stacktrace follows:
Message: ate_atendimento is not mapped [SELECT DISTINCT ate_id,ate_abertura,ate_situacao_id FROM ate_atendimento where ate_requisitante_id = 2215785101 ORDER BY ate_abertura DESC LIMIT 5]
Line | Method
->> 107 | listAtendimentos_TI in atendimento.Atendimento_tiService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 165 | doCall in atendimento.Atendimento_tiController$_closure3
| 195 | doFilter . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run . . . . . . . . in java.lang.Thread
@Transactional(readOnly = true)
public MyNegocioCRUDRetorno listAtendimentos_TI(Long idRequisitante){
MyNegocioCRUDRetorno oRetorno = new MyNegocioCRUDRetorno(data: []);
oRetorno.data = Atendimento_ti.findAll(" FROM Atendimento ate where ate.requisitante = "+idRequisitante+" ORDER BY ate.abertura DESC",[max: 5]);
oRetorno.status = (oRetorno.data != null);
if (oRetorno.status) {
oRetorno.data.each {atendimento_ti ->
dataAcima24Horas(atendimento_ti);
}
return oRetorno;
}
return null;
}
Para se registrar, clique aqui.