List<GenericValue> to EntityListIterator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

List<GenericValue> to EntityListIterator

g.fitini
Hi to everyone, i’ve done the following query with the IN clause.

    List<GenericValue> XXXList = delegator.findList("XXX", null, null, null, null, false);
       
        List<GenericValue> listIt =
                 EntityUtil.filterByCondition(XXXList,
                EntityCondition.makeCondition("field",
                EntityOperator.IN, listInClause));

QUERY : select * from XXX where field IN (..,..,..,...)


now, i want to transform ‘listIt’ , to EntityListIterator. How can do that?

I need to transform it to a EntityListIterator because i’ve done a custom service, that wrap ‘performFind’ service.
So, i’ve the same OUT parameters .

Any suggestions??
Thanks

Reply | Threaded
Open this post in threaded view
|

Re: List<GenericValue> to EntityListIterator

Lei Wu
Using delegator.find() instead of delegator.findList() would help.


On Mon, Mar 10, 2014 at 7:35 PM, <[hidden email]> wrote:

> Hi to everyone, i've done the following query with the IN clause.
>
>     List<GenericValue> XXXList = delegator.findList("XXX", null, null,
> null, null, false);
>
>         List<GenericValue> listIt =
>                  EntityUtil.filterByCondition(XXXList,
>                 EntityCondition.makeCondition("field",
>                 EntityOperator.IN, listInClause));
>
> QUERY : select * from XXX where field IN (..,..,..,...)
>
>
> now, i want to transform 'listIt' , to EntityListIterator. How can do that?
>
> I need to transform it to a EntityListIterator because i've done a custom
> service, that wrap 'performFind' service.
> So, i've the same OUT parameters .
>
> Any suggestions??
> Thanks
>
>
Reply | Threaded
Open this post in threaded view
|

Re: List<GenericValue> to EntityListIterator

Paul Piper
In reply to this post by g.fitini
Just to be sure: You want to Iterate over the list or you are having a problem with the clauses?

For the former: You can either get the iterator from the List Object:

Iterator it= listIt.iterator();
while(it.hasNext()) {
   GenericValue obj = it.next();
   // Your code here

}


or you can iterate like this:

for(GenericValue obj : listIt){
   // Your code here...

}