Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312903 - Support CDOQuery.getResult(CDOID.class) without resolving CDOIDs to EObjects
Summary: Support CDOQuery.getResult(CDOID.class) without resolving CDOIDs to EObjects
Status: CLOSED WORKSFORME
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Victor Roldan Betancort CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-14 09:43 EDT by Victor Roldan Betancort CLA
Modified: 2011-01-29 07:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Roldan Betancort CLA 2010-05-14 09:43:51 EDT
While performing a custom query which is supposed to return CDOIDs, I get the actual objects while iterating in the returning result List, instead of the CDOIDs I asked for.
Comment 1 Victor Roldan Betancort CLA 2010-06-07 06:13:41 EDT
It appears QueryResultList is just introduced to resolve CDOID as CDOObject. I think this kind of automatic resolving shall be done by the client.
However, this could break already existing queries that return CDOID, but the client do get the actual CDOObjects instead. This is the case of ResourceQuery. Other clients that have developed custom queries could experience the same problem.

The easy fix would be changing:

  @Override
  public List<T> asList()
  {
    List<Object> result = new ArrayList<Object>();
    while (super.hasNext())
    {
      result.add(super.next());
    }

    return new QueryResultList(result);
  }
  
to:

  @Override
  public List<T> asList()
  {
    List<T> result = new ArrayList<T>();
    while (super.hasNext())
    {
      result.add(super.next());
    }

    return result;
  }
  
I suggest we change this before there are more queries and more clients relying on the current semantics. Eike, what do you think?
Comment 2 Eike Stepper CLA 2010-06-29 04:50:57 EDT
Rebasing all outstanding enhancements requests to version 4.0
Comment 3 Eike Stepper CLA 2010-07-26 04:13:28 EDT
(In reply to comment #1)
> It appears QueryResultList is just introduced to resolve CDOID as CDOObject. I
> think this kind of automatic resolving shall be done by the client.

Generally? Why do you think that?
Comment 4 Victor Roldan Betancort CLA 2011-01-28 10:59:36 EST
lets talk about this bug again :P 
Well, probably most of the time people would like to get EObject. Granted, what happens when someone asks for CDOIDs? wont be possible.
Comment 5 Eike Stepper CLA 2011-01-29 02:01:45 EST
According to CDOQueryImpl.createQueryResult(Class<T>) the following should already work:

   List<CDOID> result = query.getResult(CDOID.class);

Please reopen if that does not work for you.
Comment 6 Victor Roldan Betancort CLA 2011-01-29 05:46:01 EST
Ok, I'll check it. It may have changed for 4.0 at some point and I didnt notice.
Comment 7 Eike Stepper CLA 2011-01-29 07:22:21 EST
The history says it's there for ages :P