Estou tentando fazer a seguinte consulta:
[code]Session session = HibernateUtil.getSession();
RelatorioAgentesVO resposta = new RelatorioAgentesVO();
String cc = "SELECT SUM(cc.MARGEM_LIQUIDA) " +
"from CARTAO_DE_CREDITO cc " +
"JOIN AGENTE_CARTAO agcc on agcc.CARTAO_FK = cc.ID " +
"WHERE (cc.ESTADO_FK = 2 or cc.ESTADO_FK = 3) " +
"AND agcc.AGENTE_FK = " + ag.getIdAgente() + " GROUP BY agcc.AGENTE_FK ";
Query qcc = session.createSQLQuery(cc);
Double valorcc = (Double) qcc.uniqueResult();[/code]
StackTrace:
02:22:57,623 INFO [DoubleType] could not read column value from result set: ; Column ‘’ not found.
02:22:57,627 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: S0022
02:22:57,627 ERROR [JDBCExceptionReporter] Column ‘’ not found.
No mapeamento está:
<bag name="agentes" table="AGENTE_CARTAO" cascade="none" fetch="select">
<key column="CARTAO_FK" />
<many-to-many column="AGENTE_FK" class="Agente" fetch="select" />
</bag>