I am using hibernate 5.2 and java 8
i have a situation where i am using hql to do the following, where from and to are LocalDateTime objects passed in the method:
Query buyQuery = session
.createQuery("SELECT sum(price * quantity) FROM Transaction where transactionType='buy' and transactionDateTime between :from and :to");
buyQuery.setParameter("from", from);
buyQuery.setParameter("to", to);
sb.setTotalPurchases((Double) buyQuery.getSingleResult());
Hibernate 5.2 says that it has native support for these date objects so I don't think it is that issue however i get a null pointer exception, when trying to set sb because the query returns null.
My HQL is rusty (i normally use the criterion api) so my question is does the hql look right and if so can anyone point me to the source of my issues?
Thanks :)