Here's a minimal version of the code that took me a lot of time to figure out why it's not working:
Query q = session.createQuery(queryString);
q.setTimestamp(0, new java.util.Date());
The error was:
Unset positional parameter at position: 0
When I replaced setTimestamp() with setParameter():
Query q = session.createQuery(queryString);
q.setParameter(0, new java.util.Date());
And it worked, but I can't figure out why. I'm using hibernate 3.2.1.
EDIT: Where did the post with the other suggestion go? This was it!!
There was a answer here previously that suggested to use java.sql.Timestamp instead of java.util.Date. With this little modification, the setTimestamp method works as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With