I guess this can be due to many things. In my case it was having "WHERE id IN" condition in my query and I was setting IDs separated by dash as a string using setString method on PreparedStatement.
Not sure if there is better way to do this but I just added placeholder in my statement and replaced it by values on my own.