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?

@ 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)

Not sure that you How to know how to write a comparator, but it's the beginning.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -