How to incorporate wildcards with place holder variables in Java using SQL -
hello following block of code represents 1 of options user can put in perform query search. is, returns when formation name spelled out. however, trying make work partial entries well.
if (!strings.isnullorempty(searchparameters.get("formation"))) { nativequeryfromandwhereclause.append(" , formation :formation "); parameters.put("formation", searchparameters.get("formation")); }
notice ":formation" place holder variable. when try add % around it, breaks. tips or suggestions how can make work? ton!
make sure put quotes around follows:
if (!strings.isnullorempty(searchparameters.get("formation"))) { nativequeryfromandwhereclause.append(" , formation '%:formation%' "); parameters.put("formation", searchparameters.get("formation")); }
Comments
Post a Comment