Java criteria return Function

Asked

Viewed 25 times

1

I have a call to a function to the database using criteria, but I can’t get the result that returns in an Expression, my doubt and how to get the value returned by Expression?

public Expression<Double> fnValorPresente(Integer dataVenc, Integer dataAtual, Double valor, Double taxa) {
        EntityManager em = createEntityManager();

        CriteriaBuilder cb = em.getCriteriaBuilder();

        Expression<Integer> dataVencExp = cb.literal(dataVenc);
        Expression<Integer> dataAtualcExp = cb.literal(dataAtual);
        Expression<Double> valorExp = cb.literal(valor);
        Expression<Double> taxaExp = cb.literal(taxa);

        return cb.function("DBO.fnValorPresente_FIDC", Double.class, dataVencExp, dataAtualcExp, valorExp, taxaExp);

    }

// COMO PEGAR O VALOR RETORNADO PELA EXPRESSION
Expression<Double> fnValorPresente =  prestacoesDao.fnValorPresente(p.getDataVenc(), dataAtual, p.getValor(), 10.00);

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.