You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Justiniano, Miguel" <Ju...@Pragmatics.com> on 2005/06/14 17:59:51 UTC

Lists of objects that has a list as a property

I am currently trying to implement a sql map that will execute a query with
a variable list of search filters like so:

<select id="getItems" parameterClass="queryDto"
resultClass="java.lang.String">
	select name
	from itemTable
	where id = #id#
	<iterate property="filterList" prepend="and" conjunction=" and ">
		$filterList[].columnName$ $filterList[].comparator$
#filterList[].searchValue#
	</iterate>
</select>

The "searchValue" property on the object in the filterList is a
java.lang.Object so we can use either a regular string, a date, or a list as
the value.  Now, there's no problem when a filter uses a date or a string,
but if any filter uses a list ibatis tells me there's a NullPointerException
being thrown when i try to execute the query.

Is this a bug, and is there another get what I want working?

- miguel


____________________________ 
http://www.pragmatics.com 

Re: Lists of objects that has a list as a property

Posted by Brandon Goodin <br...@gmail.com>.
I'm not completely sure from your example where a "list value" would
fit into that and how you are expecting it to be rendered. Please
provide more detail.

Brandon

On 6/14/05, Justiniano, Miguel <Ju...@pragmatics.com> wrote:
> I am currently trying to implement a sql map that will execute a query with
> a variable list of search filters like so:
> 
> <select id="getItems" parameterClass="queryDto"
> resultClass="java.lang.String">
>         select name
>         from itemTable
>         where id = #id#
>         <iterate property="filterList" prepend="and" conjunction=" and ">
>                 $filterList[].columnName$ $filterList[].comparator$
> #filterList[].searchValue#
>         </iterate>
> </select>
> 
> The "searchValue" property on the object in the filterList is a
> java.lang.Object so we can use either a regular string, a date, or a list as
> the value.  Now, there's no problem when a filter uses a date or a string,
> but if any filter uses a list ibatis tells me there's a NullPointerException
> being thrown when i try to execute the query.
> 
> Is this a bug, and is there another get what I want working?
> 
> - miguel
> 
> 
> ____________________________
> http://www.pragmatics.com
>

Re: Lists of objects that has a list as a property

Posted by Larry Meadors <la...@gmail.com>.
Are you saying that it fails if searchValue is a list?

On 6/14/05, Justiniano, Miguel <Ju...@pragmatics.com> wrote:
> I am currently trying to implement a sql map that will execute a query with
> a variable list of search filters like so:
> 
> <select id="getItems" parameterClass="queryDto"
> resultClass="java.lang.String">
>         select name
>         from itemTable
>         where id = #id#
>         <iterate property="filterList" prepend="and" conjunction=" and ">
>                 $filterList[].columnName$ $filterList[].comparator$
> #filterList[].searchValue#
>         </iterate>
> </select>
> 
> The "searchValue" property on the object in the filterList is a
> java.lang.Object so we can use either a regular string, a date, or a list as
> the value.  Now, there's no problem when a filter uses a date or a string,
> but if any filter uses a list ibatis tells me there's a NullPointerException
> being thrown when i try to execute the query.
> 
> Is this a bug, and is there another get what I want working?
> 
> - miguel
> 
> 
> ____________________________
> http://www.pragmatics.com
>