FileDocCategorySizeDatePackage
OrderByParser.javaAPI DocHibernate 3.2.51530Tue Dec 07 17:24:14 GMT 2004org.hibernate.hql.classic

OrderByParser

public class OrderByParser extends Object implements Parser
Parses the ORDER BY clause of a query

Fields Summary
private final PathExpressionParser
pathExpressionParser
Constructors Summary
Methods Summary
public voidend(QueryTranslatorImpl q)

	
public voidstart(QueryTranslatorImpl q)

	
public voidtoken(java.lang.String token, QueryTranslatorImpl q)

		pathExpressionParser = new PathExpressionParser();
		pathExpressionParser.setUseThetaStyleJoin( true ); //TODO: would be nice to use false, but issues with MS SQL
	

		if ( q.isName( StringHelper.root( token ) ) ) {
			ParserHelper.parse( pathExpressionParser, q.unalias( token ), ParserHelper.PATH_SEPARATORS, q );
			q.appendOrderByToken( pathExpressionParser.getWhereColumn() );
			pathExpressionParser.addAssociation( q );
		}
		else if ( token.startsWith( ParserHelper.HQL_VARIABLE_PREFIX ) ) { //named query parameter
			q.addNamedParameter( token.substring( 1 ) );
			q.appendOrderByToken( "?" );
		}
		else {
			q.appendOrderByToken( token );
		}