3

In one of my mapped classes, I have a Set field mapped to the DB via hibernate. I now need this collection to be sorted according to some logic, which I wrote into a new Comparator implementation. I changed the field type to SortedSet, added this Comparator as an attribute to my hibernate mapping (XML, no annotations), assuming Hibernate retrieved all objects from the DB, then sorts using the given Comparator.

A colleague brought up the possibility that there is a performance price hidden here, as Hibernate actually uses insertion sort, meaning it calls the compare method numerous times for every object it loads. Is this true? Are there any other performance issues to mapping a sorted collection?

4

0 に答える 0