Well, I've posted questions related to nested iterate tags before but with very limited responses.

Zsolt, I've tried using nested iterate tags but I've found that the property of the outer iterate tag doesn't seem to expand. Here's the message I posted a while back and got no replies. If anyone feels like giving their input, it would be appreciated.

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 above 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 in it crapping out when trying to get the value of fields.

Any ideas?






----- Original Message ----- From: "Zsolt" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, November 04, 2005 12:05 PM
Subject: How to use nested "<iterate"


Hi,

can somebody provide me how to use nested "<iterate" ?

Zsolt






Reply via email to