I'm using Hibernate in my current project. I have a class TreeNode that has a Set<TreeNode> getChildren() method. I would like to somehow convert this to something like List<TreeNode> getChildren() and make sure the list is returned in order as determined by the getName() value of each TreeNode. I realize that I could code up the getChildren method myself, returning an ordered List, but I would like to see if Hibernate can do it all behind the scenes first.
1. Is this possible?
2. If so, any quick tips?
3. Do I need to tell me underlying DB that I want collation based on the Name column or is the solution achieved using only Hibernate features?
Thanks.
|