It's all about the answers!

Ask a question

RTC 2.0 querying: orderByAsc/Dsc includes duplicate results


John Nason (2.4k1012) | asked Nov 11 '09, 6:51 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hi,
I've noticed some very disturbing query behavior as of late. I'm trying to do query result sorting where there is some referenced data I'd potentially like to sort by as well. For example:
query.orderByAsc(MyQueryModel.ROOT.object().referencedObject().attribute())

Despite also including "query.distinct()" I always get a result set that includes duplicates... but ONLY when ordering by a referenced object's attribute. For instance,
query.orderByAsc(MyQueryModel.ROOT.object().attribute())

does NOT include any duplicate results. This applies to multi-dimensional sorts as well. If they are all "first order" attributes then I get the right result set. If I try to order by any "second order" attributes then the result set includes duplicates.

So... what gives? This seems completely broked to me. Anyone know if this is known or if there is something that could be off in our query building?
Thanks!
John

2 answers



permanent link
Ritchie Schacher - IBM (47611) | answered Nov 18 '09, 4:23 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Querying: OrderByAsc/Dsc returns duplicate results when ordering on
referenced attributes despite using distinct() (99420)

--
Ritchie Schacher
Jazz Server Development

"Patrick Streule" <patrick_streule> wrote in message
news:op.u3ls3214xfsgax@huangshan.local...
I've noticed some very disturbing query behavior as of late. I'm
trying to do query result sorting where there is some referenced data
I'd potentially like to sort by as well. For example:
query.orderByAsc(MyQueryModel.ROOT.object().referencedObject().attribute())
Despite also including "query.distinct()" I always get a
result set that includes duplicates... but ONLY when ordering by a
referenced object's attribute. For instance,
query.orderByAsc(MyQueryModel.ROOT.object().attribute())

does NOT include any duplicate results. This applies to
multi-dimensional sorts as well. If they are all "first
order" attributes then I get the right result set. If I try to
order by any "second order" attributes then the result set
includes duplicates.

So... what gives? This seems completely broked to me. Anyone know if
this is known or if there is something that could be off in our query
building?
Thanks!
John

I haven't seen this behavior yet, but I'd suggest you file a defect for
this.

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Patrick Streule (4.9k21) | answered Nov 18 '09, 1:53 p.m.
JAZZ DEVELOPER
I've noticed some very disturbing query behavior as of late. I'm
trying to do query result sorting where there is some referenced data
I'd potentially like to sort by as well. For example:
query.orderByAsc(MyQueryModel.ROOT.object().referencedObject().attribute())
Despite also including "query.distinct()" I always get a
result set that includes duplicates... but ONLY when ordering by a
referenced object's attribute. For instance,
query.orderByAsc(MyQueryModel.ROOT.object().attribute())

does NOT include any duplicate results. This applies to
multi-dimensional sorts as well. If they are all "first
order" attributes then I get the right result set. If I try to
order by any "second order" attributes then the result set
includes duplicates.

So... what gives? This seems completely broked to me. Anyone know if
this is known or if there is something that could be off in our query
building?
Thanks!
John

I haven't seen this behavior yet, but I'd suggest you file a defect for
this.

--
Regards,
Patrick
Jazz Work Item Team

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.