Author: porcelli
Date: 2009-04-22 16:01:25 -0400 (Wed, 22 Apr 2009)
New Revision: 16410
Modified:
core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolution.g
core/branches/antlr3/src/main/java/org/hibernate/sql/ast/phase/hql/resolve/HQLResolution.java
Log:
now 2nd pase is using the FromPathResolutionStrategy
Modified:
core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolution.g
===================================================================
---
core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolution.g 2009-04-22
20:00:03 UTC (rev 16409)
+++
core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolution.g 2009-04-22
20:01:25 UTC (rev 16410)
@@ -41,6 +41,7 @@
package org.hibernate.sql.ast.phase.hql.resolve;
import org.antlr.runtime.tree.CommonTree;
+import org.hibernate.sql.ast.common.JoinType;
import org.hibernate.sql.ast.phase.hql.resolve.path.PathedPropertyReferenceSource;
}
@@ -94,6 +95,13 @@
// TODO Auto-generated method stub
}
+ protected void pushFromStrategy( JoinType joinType,
+ CommonTree assosiationFetchTree, CommonTree propertyFetchTree,
+ CommonTree alias ) {
+ }
+
+ protected void popStrategy(){
+ }
}
filterStatement[String collectionRole]
@@ -197,7 +205,10 @@
;
joins
- : ^(PROPERTY_JOIN joinType FETCH? ALIAS_NAME PROP_FETCH?
(collectionExpression|propertyReference) withClause?)
+ : ^(PROPERTY_JOIN jt=joinType ft=FETCH? an=ALIAS_NAME pf=PROP_FETCH?
+ { pushFromStrategy($jt.joinType, $ft, $pf, $an ); }
+ (collectionExpression|propertyReference) withClause?)
+ { popStrategy(); }
| ^(PERSISTER_JOIN joinType persisterSpaceRoot onClause?)
;
@@ -209,10 +220,10 @@
: ^(ON searchCondition)
;
-joinType
- : CROSS
- | INNER
- | (LEFT | RIGHT | FULL) OUTER?
+joinType returns [JoinType joinType]
+ : CROSS { $joinType = JoinType.CROSS; }
+ | INNER { $joinType = JoinType.INNER; }
+ | (LEFT { $joinType = JoinType.LEFT; } | RIGHT { $joinType = JoinType.RIGHT; } | FULL
{ $joinType = JoinType.FULL; }) OUTER?
;
selectClause
Modified:
core/branches/antlr3/src/main/java/org/hibernate/sql/ast/phase/hql/resolve/HQLResolution.java
===================================================================
---
core/branches/antlr3/src/main/java/org/hibernate/sql/ast/phase/hql/resolve/HQLResolution.java 2009-04-22
20:00:03 UTC (rev 16409)
+++
core/branches/antlr3/src/main/java/org/hibernate/sql/ast/phase/hql/resolve/HQLResolution.java 2009-04-22
20:01:25 UTC (rev 16410)
@@ -26,15 +26,16 @@
import org.antlr.runtime.tree.Tree;
import org.antlr.runtime.tree.TreeNodeStream;
import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Queryable;
import org.hibernate.sql.ast.alias.DefaultTableAliasGenerator;
import org.hibernate.sql.ast.alias.TableAliasGenerator;
+import org.hibernate.sql.ast.common.JoinType;
import org.hibernate.sql.ast.phase.hql.parse.HQLParser;
import org.hibernate.sql.ast.phase.hql.resolve.path.PathResolutionStrategy;
import org.hibernate.sql.ast.phase.hql.resolve.path.PathResolutionStrategyStack;
import org.hibernate.sql.ast.phase.hql.resolve.path.PathedPropertyReferenceSource;
import
org.hibernate.sql.ast.phase.hql.resolve.path.impl.BasicPathResolutionStrategySupport;
+import
org.hibernate.sql.ast.phase.hql.resolve.path.impl.FromClausePathResolutionStrategy;
import org.hibernate.sql.ast.tree.Table;
import org.hibernate.sql.ast.tree.Table.EntityTableSpace;
import org.hibernate.sql.ast.util.TreePrinter;
@@ -72,12 +73,17 @@
.push( new BasicPathResolutionStrategySupport( this ) );
}
- protected void registerPersisterSpace( CommonTree entityName, CommonTree alias ) {
- String entityPersisterName = sessionFactory.getImportedClassName( entityName.getText()
);
- Queryable entityPersister = ( Queryable ) sessionFactory.getEntityPersister(
entityPersisterName );
+ protected void registerPersisterSpace( CommonTree entityName,
+ CommonTree alias ) {
+ String entityPersisterName = sessionFactory
+ .getImportedClassName( entityName.getText() );
+ Queryable entityPersister = ( Queryable ) sessionFactory
+ .getEntityPersister( entityPersisterName );
- TableAliasGenerator.TableAliasRoot tableAliasRoot =
getTableAliasGenerator().generateSqlAliasRoot( entityPersister, alias.getText() );
- EntityTableSpace tableSpace = new Table.EntityTableSpace( entityPersister,
tableAliasRoot );
+ TableAliasGenerator.TableAliasRoot tableAliasRoot = getTableAliasGenerator()
+ .generateSqlAliasRoot( entityPersister, alias.getText() );
+ EntityTableSpace tableSpace = new Table.EntityTableSpace(
+ entityPersister, tableAliasRoot );
registerPersisterSpace( tableSpace.getPersisterSpace() );
}
@@ -118,20 +124,34 @@
// TODO Auto-generated method stub
}
- protected void registerEntityPersisterSpace( CommonTree entityName,
+ protected void pushFromStrategy( JoinType joinType,
+ CommonTree assosiationFetchTree, CommonTree propertyFetchTree,
CommonTree alias ) {
- String entityPersisterName = sessionFactory
- .getImportedClassName( entityName.getText() );
- EntityPersister entityPersister = sessionFactory
- .getEntityPersister( entityPersisterName );
+ boolean assosiationFetch = assosiationFetchTree != null ? true : false;
+ boolean propertyFetch = propertyFetchTree != null ? true : false;
+ pathResolutionStrategyStack.push( new FromClausePathResolutionStrategy(
+ this, joinType, assosiationFetch, propertyFetch, alias
+ .getText() ) );
+ }
- EntityTableSpace tableSpace = new Table.EntityTableSpace(
- ( Queryable ) entityPersister, getTableAliasGenerator()
- .generateSqlAliasRoot( ( Queryable ) entityPersister,
- alias.getText() ) );
- registerPersisterSpace( tableSpace.getPersisterSpace() );
+ protected void popStrategy() {
+ pathResolutionStrategyStack.pop();
}
+ protected void registerEntityPersisterSpace( CommonTree entityName,
+ CommonTree alias ) {
+ // String entityPersisterName = sessionFactory
+ // .getImportedClassName( entityName.getText() );
+ // EntityPersister entityPersister = sessionFactory
+ // .getEntityPersister( entityPersisterName );
+ //
+ // EntityTableSpace tableSpace = new Table.EntityTableSpace(
+ // ( Queryable ) entityPersister, getTableAliasGenerator()
+ // .generateSqlAliasRoot( ( Queryable ) entityPersister,
+ // alias.getText() ) );
+ // registerPersisterSpace( tableSpace.getPersisterSpace() );
+ }
+
private void registerPersisterSpace( PersisterSpace persisterSpace ) {
persisterSpaceContext.registerPersisterSpace( persisterSpace );
}
Show replies by date