public static List<Transaction1> debitSourceAccBalance (Integer youraccinput, Integer toaccinput, String recname, Double amtsender) {
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Query q = em.createQuery("SELECT t from Transaction1 t where t.fromAccNo =:youraccinput AND t.toAccNo =:toaccinput AND t.name =:recname AND t.amount >=:amtsender");
q.setParameter("youraccinput", youraccinput);
q.setParameter("toaccinput", toaccinput);
q.setParameter("recname", recname);
q.setParameter("amtsender", amtsender);
Double currbal = (Double)q.getSingleResult();
amtsender = currbal - amtsender;
Query u = em.createQuery("UPDATE Transaction1 t SET t.amount =:amtsender WHERE t.fromAccNo =:youraccinput AND t.toAccNo =:toaccinput");
u.setParameter("youraccinput", youraccinput);
u.setParameter("toaccinput", toaccinput);
u.setParameter("amtsender", amtsender);
u.executeUpdate();
return q.getResultList();
Сервлет:
Integer youraccinput = Integer.parseInt(request.getParameter("fromAccNo"));
Integer toaccinput = Integer.parseInt(request.getParameter("toAccNo"));
String recname = request.getParameter("name");
Double amtsender = Double.parseDouble(request.getParameter("amount"));
List<Transaction1> results = Transaction1.debitSourceAccBalance(youraccinput, toaccinput, recname, amtsender);
results.listIterator();
request.getRequestDispatcher("ListSingleTransaction").forward(request, response);
Почему я получаю это сообщение об ошибке ??пожалуйста помогите исправить !!
"Entities.Transaction1 не может быть приведен к java.lang.Double"