"select c.type, c.date, sum(c.amount) from CustomerPayment c where c.date like '%" + year + "' and c.type='Cash'"
Above hibernate query gives ClassCastError because of my select statement.
How can i write it in proper way? Do need to use criteria for summation? What is the y good for above query? I'm confused.
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to CustomerPayment
at tekirmobile.clController.getTotalCash(clController.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
I get these error because of above query