KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > hql > classic > FromPathExpressionParser


1 //$Id: FromPathExpressionParser.java,v 1.6 2005/02/22 14:07:35 oneovthafew Exp $
2
package org.hibernate.hql.classic;
3
4 import org.hibernate.QueryException;
5 import org.hibernate.persister.collection.CollectionPropertyNames;
6 import org.hibernate.type.Type;
7
8 public class FromPathExpressionParser extends PathExpressionParser {
9
10     public void end(QueryTranslatorImpl q) throws QueryException {
11         if ( !isCollectionValued() ) {
12             Type type = getPropertyType();
13             if ( type.isEntityType() ) {
14                 // "finish off" the join
15
token( ".", q );
16                 token( null, q );
17             }
18             else if ( type.isCollectionType() ) {
19                 // default to element set if no elements() specified
20
token( ".", q );
21                 token( CollectionPropertyNames.COLLECTION_ELEMENTS, q );
22             }
23         }
24         super.end( q );
25     }
26
27     protected void setExpectingCollectionIndex() throws QueryException {
28         throw new QueryException( "illegal syntax near collection-valued path expression in from: " + getCollectionName() );
29     }
30
31
32 }
33
Popular Tags