|
I'm trying to do a search on some fields using
keywords. Both the keywords and the fields are being passed into the SQL
Map but IBatis doesn't seem to expand the property specified in the outer
iterate tag. Both keywords and fields are of type java.util.List and
contain java.lang.String objects.
<iterate property="keywords"
prepend="AND">
<iterate conjunction="OR" property="fields" prepend="AND" open="(" close=")"> $fields[]$ LIKE '%$keywords[]$%' </iterate> </iterate> When the following executes, I get the following
error (it craps out when trying to get the value of keywords)
org.springframework.jdbc.UncategorizedSQLException:
SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null];
error code [0];
--- The error occurred in com/xxx/xxx/xxx/SQLMap.xml. --- The error occurred while preparing the mapped statement for execution. --- Check the advancedSearchEndUsers. --- Check the parameter map. --- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/xxx/xxx/xxx/xxx/SQLMap.xml. --- The error occurred while preparing the mapped statement for execution. --- Check the advancedSearchEndUsers. --- Check the parameter map. --- Cause: java.lang.NullPointerException com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/xxx/xxx/xxx/xxx/SQLMap.xml. --- The error occurred while preparing the mapped statement for execution. --- Check the advancedSearchEndUsers. --- Check the parameter map. --- Cause: java.lang.NullPointerException Caused by: java.lang.NullPointerException at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:610) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:105) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:82) at com.ibatis.sqlmap.engine.mapping.statement.PaginatedDataList.getList(PaginatedDataList.java:138) at com.ibatis.sqlmap.engine.mapping.statement.PaginatedDataList.pageTo(PaginatedDataList.java:98) at com.ibatis.sqlmap.engine.mapping.statement.PaginatedDataList.<init>(PaginatedDataList.java:46) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForPaginatedList(SqlMapExecutorDelegate.java:667) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForPaginatedList(SqlMapSessionImpl.java:109) For testing purposes, I then made fields the
property of the outer loop and keywords the property of the inner loop.
This resulted it crapping out when trying to get the value of
fields.
Any ideas?
|
