ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From behlma <beh...@googlemail.com>
Subject One-To-Many Collection - ordering/sorting of the collection elements
Date Mon, 14 Jan 2008 17:36:46 GMT

Hi guys,
suppose we have a simple one-to-many relationship between Category and
Forum. A Forum also has a "position" (column), that specifies its index
position in a category.

Now this query correctly returns a List of Categories, each with a list of
"child"-forums.

select *
from Category, Forum
where Category.id = Forum.categoryId
order by Category.id,Forum.position asc

The problem however is, that even though the sql correctly sorts the forums
(Forum.position.asc), the Forums actually appear in a random order on the
java side, each time the query gets executed. 

Interestingly I observed the exact same behaviour with hibernate some time
ago, so I thought it might have to do with the way "groupBy" works
internally.

Anyone?

Thanks!

-- 
View this message in context: http://www.nabble.com/One-To-Many-Collection---ordering-sorting-of-the-collection-elements-tp14806634p14806634.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message