Meu metodo:
public BigDecimal buscaMediaVlTotal() {
String query = "select AVG(c.vl_total) from Cliente c where c.vl_total >= 300 and c.id_customer between 15 and 200 ";
return (BigDecimal) em.createQuery(query).getSingleResult();
}
ta dando essa exception:
mai 04, 2017 1:59:34 PM org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService
INFO: HHH000397: Using ASTQueryTranslatorFactory
Exception in thread "main" java.lang.ClassCastException: java.lang.Double cannot be cast to java.math.BigDecimal
at br.com.testeback2017.dao.ClienteDao.buscaMediaVlTotal(ClienteDao.java:25)
at br.com.testeback2017.main.Insere.main(Insere.java:52)
como corrigir esse problema ?