From: <one...@us...> - 2003-02-28 07:03:50
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv28314/sf/hibernate/hql Added Files: FromPathExpressionParser.java Log Message: reworked HQL, adding support for AS syntax in FROM clause non-collection associations may now be aliased --- NEW FILE: FromPathExpressionParser.java --- //$Id: FromPathExpressionParser.java,v 1.1 2003/02/28 07:03:48 oneovthafew Exp $ package net.sf.hibernate.hql; import net.sf.hibernate.QueryException; import net.sf.hibernate.type.Type; public class FromPathExpressionParser extends PathExpressionParser { public void end(QueryTranslator q) throws QueryException { if ( !isCollectionValued() ) { Type type = getPropertyType(q); if ( type.isEntityType() ) { // "finish off" the join token(".", q); token(null, q); } else if ( type.isPersistentCollectionType() ) { // default to element set if no elements() specified token(".", q); token(COLLECTION_ELEMENTS, q); } } super.end(q); } protected void setExpectingCollectionIndex() throws QueryException { throw new QueryException("expecting .elements or .indices after collection path expression in from"); } } |