public static String addOrder ( String queryString , String propertyPath , boolean asc ) { if ( StringUtils . containsIgnoreCase ( queryString , "order by" ) ) { return queryString ; } StringBuilder sb = new StringBuilder ( queryString ) ; sb . append ( " ORDER BY " ) ; sb . append ( getAlias ( queryString ) ) ; sb . append ( "." ) ; sb . append ( propertyPath ) ; sb . append ( " " ) ; sb . append ( asc ? "ASC" : "DESC" ) ; return sb . toString ( ) ; }
Add order by clause to queryString