Hi,

List.indexOf(..) is a linear search (unless the list is known to be ordered and 
you can use binary search). So on average such lookup would resolve ~50% of the 
objects. 

Another way is to query for this object directly against the DB. Yet another is 
to do an in-memory check of the object against the original SelectQuery 
qualifier: 

   query.getQualifier().match(object);

Neither of the 2 will always be equivalent to List.indexOf(..). After all DB 
data changes over time, and also SQL and in-memory eval have subtle 
differences. So make a decision based on the task at hand.

Andrus 


> On Dec 1, 2014, at 1:05 PM, Aradiusz Milewski <[email protected]> wrote:
> 
> Hi
> 
> I have a SelectQuery with setPageSize. After running this query i would like 
> to know on which index is specific object in this list, without fetching full 
> list of objects into memory. Is it possible to do it using Cayenne API ?
> 
> Thanks
> Arek
> 

Reply via email to