I have the following code:
conditions.add("mydate = str_to_date('"+date_from_user+"', '%Y-%m-%d')");
the above works fine but since I am taking input from the user and shoving it in my query I'm risking the security of the query. So I wanted to use named template so I changed the code to:
conditions.add("mydate = str_to_date(':mydate', '%Y-%m-%d')");
namedParams.put("mydate", date_from_user);
However, the above code doesn't work and produces the following error message:
<SQLWarning ignored: SQL state 'HY000', error code '1411', message [Incorrect datetime value: ':mydate' for function str_to_date]>
so it seems that namedparameter isn't picking up the value..