Estou executando uma consulta utilizando java 8, glassfish 4.1 e ao executar aparece a seguinte mensagem
2016-06-03T11:04:43.394-0300|Advertência: Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
Error Code: 0
Call: Select * from Cdr_Stat where msisdn =? and callDatetime between ‘2016-06-03 00:00:00.00’ and '2016-06-03 23:59:59.99’
bind => [1 parameter bound]
Meu código é:
@Override
public Boolean getCdrUtilizouHoje(Integer duration,
String msisdnOriginator, int dialstatus, Timestamp dataAtual) {
//TODO ver o retorno cdrStat
SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd");
String hoje = new String();
Timestamp stamp =dataAtual;// new Timestamp(System.currentTimeMillis());
try {
hoje = formato.format(stamp);
} catch (Exception e) {
System.out.println(e.getMessage());
}
String strstmt="Select * from Cdr_Stat where msisdn = ?1 and callDatetime between 'hoje 00:00:00.00' and 'hoje 23:59:59.99'".replaceAll("hoje", hoje);
List<CdrStat> rs =em.createNativeQuery("Select * from Cdr_Stat where msisdn =?1 and callDatetime between '2016-06-03 00:00:00.00' and '2016-06-03 23:59:59.99'",CdrStat.class)
.setParameter(1, msisdnOriginator)
.getResultList();
return !rs.isEmpty();
}
Funciona perfeitamente com java 7 e glassfish 3.1.2.2