Hi I need a small help in getting the data as per the order it's entered in the table. I am building a menu that has sub-menus. In SUB_MENU table I also have a order_by column and in my hbm.xml file I specify orderby on that column it returns me data in correct order.
ParentMenu does not have order_by column how can I get the data ordered by on id column for my ParentMenu i.e. a sequence. Or do I need a order_by column in ParentMenu table and then specify ordyby on that column too.
MB<br />Sun Certified Programmer for Java2 Platform
Joined: Jul 18, 2002
Any idea how I can achieve this. Thanks
Joined: Feb 09, 2005
What happens if you try adding something like sort="MyComparatorClass" to the set of SubMenus (in the ParentMenu mapping)?
(Then you could implement a class which implements java.util.Comparator and whose compareTo method allows the SubMenu objects to be sorted by the property that maps to your order-by column.) [ September 06, 2006: Message edited by: newbie awo ]
But the issue is how to get the data ordered by id column on my Parent Menu. id is a number field in my Menu Table. That is my Parent menu is not ordered. e.g. in my Parent Menu table If I have the following data
A 32 B 2 C 4
it shows up in that order, but I would like to see it in the following order i.e. order by id