Community
Participate
Working Groups
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.
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?
Rebasing all outstanding enhancements requests to version 4.0
(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?
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.
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.
Ok, I'll check it. It may have changed for 4.0 at some point and I didnt notice.
The history says it's there for ages :P