1 package org.hibernate.hql.classic; 3 4 import org.hibernate.QueryException; 5 import org.hibernate.util.StringHelper; 6 7 10 11 public class OrderByParser implements Parser { 12 13 16 18 21 private final PathExpressionParser pathExpressionParser; 22 23 { 24 pathExpressionParser = new PathExpressionParser(); 25 pathExpressionParser.setUseThetaStyleJoin( true ); } 27 28 public void token(String token, QueryTranslatorImpl q) throws QueryException { 29 30 if ( q.isName( StringHelper.root( token ) ) ) { 31 ParserHelper.parse( pathExpressionParser, q.unalias( token ), ParserHelper.PATH_SEPARATORS, q ); 32 q.appendOrderByToken( pathExpressionParser.getWhereColumn() ); 33 pathExpressionParser.addAssociation( q ); 34 } 35 else if ( token.startsWith( ParserHelper.HQL_VARIABLE_PREFIX ) ) { q.addNamedParameter( token.substring( 1 ) ); 37 q.appendOrderByToken( "?" ); 38 } 39 else { 40 q.appendOrderByToken( token ); 41 } 42 } 43 44 public void start(QueryTranslatorImpl q) throws QueryException { 45 } 46 47 public void end(QueryTranslatorImpl q) throws QueryException { 48 } 49 50 } 51 | Popular Tags |