Ok, the problem still exists with tomcat 7. It looks like a problem with the query which probably works with other databases, other than postgres, because of the type conversion but it doesn't with postrgres.
Also please ignore my previous response. It was about another issue not related to this. I thought I was responding to one of my other postings :) So the problem exists in tomcat8 and tomcat7 and is trivially reproducible.
thanks