I have a settings table in which there are multiple settings. This table has a column "idss". I want to get all the results grouped by this "idss". So I am expecting a List which will contain single unique entries as well as entries having common "idss" grouped into a list. Please help me on how to do this.
Something like
List<Settings>
-> List<Setting> ( explanation : idss=1, List<Setting> has one setting )
-> List<Setting> ( explanation : idss=2, List<Setting> has two setting with common idss )
-> List<Setting> ( explanation : idss=3, List<Setting> has four setting with common idss )
I am using find() method form the hibernate template using spring orm
There is no way to get the desired output structure directly from JPA or SQL. You can however read the data flat using order by idss and built-up the desired structure while iterating over the result set.