How Do I: Use a "WHERE... LIKE" Clause in a Database Control?
Curly braces "{}" within literals (strings within quotes) are ignored. This means statements like the following will not work as you might expect:
/** * @jws:sql statement:: * SELECT name * FROM employees * WHERE content LIKE '%{partialName}%' * :: */ public String[] partialNameSearch(String partialName);
Since the curly braces are ignored inside the literal string, the expected substitution of the partialName Java String into the SELECT statement does not occur. To avoid this problem, pre-format the match string in the JWS file before invoking the Database control method, as shown below:
String partialNameToMatch = "%" + matchString + "%" String [] names = myDBControl.partialNameSeach(partialNameToMatch);
For more information about parameter substitution in Database control methods, see Parameter Substitution in @jws:sql Statements.