Are you saying that the records are not returned in the order which the ORDER BY clause specifies? I doubt that you are.
This is the part I don't understand. You seem to be inferring some "order" in the database which isn't specified in your ORDER BY clauses. The database isn't required to order the rows in any particular way except what the ORDER BY clause specifies. In particular it isn't required to order rows the same way in two different queries -- unless, of course, the ORDER BY clauses of those queries say to do that.Originally posted by aditee sharma:
[QB]The database returns the results perfectly in order.
You seem to be inferring some "order" in the database which isn't specified in your ORDER BY clauses.
This query has an order by on one key and the when checked through toad, the results come in perfect order.
But you're asking about the second query.
I don't know. It's possible that iBatis is running your query, loading a ton of records into memory, and then grouping them. But the much more sensible thing for it to do would be to generate a second query, with a GROUP BY clause, and ask the database to execute that. I do know that iBatis was written by people who know what they are doing. I would expect them to fire a second query at the database rather than trying to replicate what the database would do.Originally posted by aditee sharma:
There is no second query. The iBATIS resultMap groupBy does not fire a 2nd query...or does it?
I guess whats happening here is your grouping is applied after ordering, while what you seek is the reverse.
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|