java - JPA @OrderBy Annotation - Ordering Strings -
I am using @Olderby annotations in my organization class which was eagerly arranged to organize a collection. is. The order in which I am ordering is of the string. However, in some instances, these stars may have numbers. How can I ensure that orderbrain annotation instead of 1,8,2,3,4,5,6,7,8,9 will order the numbers stored as strings in their numerical order?
Not sure that you How to know how to write a comparator, but it's the beginning. @ orbaby will be sorted according to the database because it is part of your SQL query Will happen. Experimenting with a custom comparator will yield your result. You can also consider combing 2 (@order bye so that you return to the database in a consistent order, then the @SortComparator for the desired order)
Comments
Post a Comment