@Override protected AST createIntoClause(String path, AST propertySpec) throws SemanticException { Queryable persister = (Queryable) getSessionFactoryHelper().requireClassPersister( path ); IntoClause intoClause = (IntoClause) getASTFactory().create( INTO, persister.getEntityName() ); intoClause.setFirstChild( propertySpec ); intoClause.initialize( persister ); addQuerySpaces( persister.getQuerySpaces() ); return intoClause; }
private void handleElements(FromReferenceNode collectionNode, String propertyName) { FromElement collectionFromElement = collectionNode.getFromElement(); QueryableCollection queryableCollection = collectionFromElement.getQueryableCollection(); String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating elements for %s", path ); fromElement = collectionFromElement; if ( !collectionFromElement.isCollectionOfValuesOrComponents() ) { getWalker().addQuerySpaces( queryableCollection.getElementPersister().getQuerySpaces() ); } setDataType( queryableCollection.getElementType() ); selectColumns = collectionFromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect ); }
FromElement addFromElement() throws SemanticException { final FromClause parentFromClause = fromClause.getParentFromClause(); if ( parentFromClause != null ) { // Look up class name using the first identifier in the path. final String pathAlias = PathHelper.getAlias( path ); final FromElement parentFromElement = parentFromClause.getFromElement( pathAlias ); if ( parentFromElement != null ) { return createFromElementInSubselect( path, pathAlias, parentFromElement, classAlias ); } } final EntityPersister entityPersister = fromClause.getSessionFactoryHelper().requireClassPersister( path ); final FromElement elem = createAndAddFromElement( path, classAlias, entityPersister, (EntityType) ( (Queryable) entityPersister ).getType(), null ); // Add to the query spaces. fromClause.getWalker().addQuerySpaces( entityPersister.getQuerySpaces() ); return elem; }
roleAlias, entityPersister, (EntityType) queryableCollection.getElementType(), joinType ); fromClause.getWalker().addQuerySpaces( queryableCollection.getCollectionSpaces() );
FromElement elem = factory.createCollection(queryableCollection, role, joinType, fetch, true); setFromElement(elem); getWalker().addQuerySpaces(queryableCollection.getCollectionSpaces()); // Always add the collection's query spaces.
private FromElement createCollectionJoin(JoinSequence collectionJoinSequence, String tableAlias) throws SemanticException { String text = queryableCollection.getTableName(); AST ast = createFromElement( text ); FromElement destination = (FromElement) ast; Type elementType = queryableCollection.getElementType(); if ( elementType.isCollectionType() ) { throw new SemanticException( "Collections of collections are not supported!" ); } destination.initializeCollection( fromClause, classAlias, tableAlias ); destination.setType( JOIN_FRAGMENT ); // Tag this node as a JOIN. destination.setIncludeSubclasses( false ); // Don't include subclasses in the join. destination.setCollectionJoin( true ); // This is a clollection join. destination.setJoinSequence( collectionJoinSequence ); destination.setOrigin( origin, false ); destination.setCollectionTableAlias( tableAlias ); // origin.addDestination( destination ); // This was the cause of HHH-242 // origin.setType( FROM_FRAGMENT ); // Set the parent node type so that the AST is properly formed. origin.setText( "" ); // The destination node will have all the FROM text. origin.setCollectionJoin( true ); // The parent node is a collection join too (voodoo - see JoinProcessor) fromClause.addCollectionJoinFromElementByPath( path, destination ); fromClause.getWalker().addQuerySpaces( queryableCollection.getCollectionSpaces() ); return destination; }
fromClause.getWalker().addQuerySpaces( entityPersister.getQuerySpaces() );
fromClause.getWalker().addQuerySpaces( entityPersister.getQuerySpaces() );
EntityPersister entityPersister = elem.getEntityPersister(); if ( entityPersister != null ) { getWalker().addQuerySpaces( entityPersister.getQuerySpaces() ); getWalker().addQuerySpaces( queryableCollection.getCollectionSpaces() ); // Always add the collection's query spaces.
join.setUseWhereFragment( collectionFromElement.useWhereFragment() ); walker.addQuerySpaces( indexEntityPersister.getQuerySpaces() );
getWalker().addQuerySpaces( elem.getEntityPersister().getQuerySpaces() );
@Override protected AST createIntoClause(String path, AST propertySpec) throws SemanticException { Queryable persister = ( Queryable ) getSessionFactoryHelper().requireClassPersister( path ); IntoClause intoClause = ( IntoClause ) getASTFactory().create( INTO, persister.getEntityName() ); intoClause.setFirstChild( propertySpec ); intoClause.initialize( persister ); addQuerySpaces( persister.getQuerySpaces() ); return intoClause; }
@Override protected AST createIntoClause(String path, AST propertySpec) throws SemanticException { Queryable persister = ( Queryable ) getSessionFactoryHelper().requireClassPersister( path ); IntoClause intoClause = ( IntoClause ) getASTFactory().create( INTO, persister.getEntityName() ); intoClause.setFirstChild( propertySpec ); intoClause.initialize( persister ); addQuerySpaces( persister.getQuerySpaces() ); return intoClause; }
private void handleElements(FromReferenceNode collectionNode, String propertyName) { FromElement collectionFromElement = collectionNode.getFromElement(); QueryableCollection queryableCollection = collectionFromElement.getQueryableCollection(); String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating elements for %s", path ); fromElement = collectionFromElement; if ( !collectionFromElement.isCollectionOfValuesOrComponents() ) { getWalker().addQuerySpaces( queryableCollection.getElementPersister().getQuerySpaces() ); } setDataType( queryableCollection.getElementType() ); selectColumns = collectionFromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect ); }
private void handleElements(FromReferenceNode collectionNode, String propertyName) { FromElement collectionFromElement = collectionNode.getFromElement(); QueryableCollection queryableCollection = collectionFromElement.getQueryableCollection(); String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating elements for %s", path ); fromElement = collectionFromElement; if ( !collectionFromElement.isCollectionOfValuesOrComponents() ) { getWalker().addQuerySpaces( queryableCollection.getElementPersister().getQuerySpaces() ); } setDataType( queryableCollection.getElementType() ); selectColumns = collectionFromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect ); }
FromElement addFromElement() throws SemanticException { FromClause parentFromClause = fromClause.getParentFromClause(); if ( parentFromClause != null ) { // Look up class name using the first identifier in the path. String pathAlias = PathHelper.getAlias( path ); FromElement parentFromElement = parentFromClause.getFromElement( pathAlias ); if ( parentFromElement != null ) { return createFromElementInSubselect( path, pathAlias, parentFromElement, classAlias ); } } EntityPersister entityPersister = fromClause.getSessionFactoryHelper().requireClassPersister( path ); FromElement elem = createAndAddFromElement( path, classAlias, entityPersister, ( EntityType ) ( ( Queryable ) entityPersister ).getType(), null ); // Add to the query spaces. fromClause.getWalker().addQuerySpaces( entityPersister.getQuerySpaces() ); return elem; }
FromElement addFromElement() throws SemanticException { FromClause parentFromClause = fromClause.getParentFromClause(); if ( parentFromClause != null ) { // Look up class name using the first identifier in the path. String pathAlias = PathHelper.getAlias( path ); FromElement parentFromElement = parentFromClause.getFromElement( pathAlias ); if ( parentFromElement != null ) { return createFromElementInSubselect( path, pathAlias, parentFromElement, classAlias ); } } EntityPersister entityPersister = fromClause.getSessionFactoryHelper().requireClassPersister( path ); FromElement elem = createAndAddFromElement( path, classAlias, entityPersister, ( EntityType ) ( ( Queryable ) entityPersister ).getType(), null ); // Add to the query spaces. fromClause.getWalker().addQuerySpaces( entityPersister.getQuerySpaces() ); return elem; }
private FromElement createEntityAssociation( String role, String roleAlias, JoinType joinType) throws SemanticException { FromElement elem; Queryable entityPersister = ( Queryable ) queryableCollection.getElementPersister(); String associatedEntityName = entityPersister.getEntityName(); // Get the class name of the associated entity. if ( queryableCollection.isOneToMany() ) { LOG.debugf( "createEntityAssociation() : One to many - path = %s role = %s associatedEntityName = %s", path, role, associatedEntityName ); JoinSequence joinSequence = createJoinSequence( roleAlias, joinType ); elem = createJoin( associatedEntityName, roleAlias, joinSequence, ( EntityType ) queryableCollection.getElementType(), false ); } else { LOG.debugf( "createManyToMany() : path = %s role = %s associatedEntityName = %s", path, role, associatedEntityName ); elem = createManyToMany( role, associatedEntityName, roleAlias, entityPersister, ( EntityType ) queryableCollection.getElementType(), joinType ); fromClause.getWalker().addQuerySpaces( queryableCollection.getCollectionSpaces() ); } elem.setCollectionTableAlias( roleAlias ); return elem; }
private FromElement createCollectionJoin(JoinSequence collectionJoinSequence, String tableAlias) throws SemanticException { String text = queryableCollection.getTableName(); AST ast = createFromElement( text ); FromElement destination = ( FromElement ) ast; Type elementType = queryableCollection.getElementType(); if ( elementType.isCollectionType() ) { throw new SemanticException( "Collections of collections are not supported!" ); } destination.initializeCollection( fromClause, classAlias, tableAlias ); destination.setType( JOIN_FRAGMENT ); // Tag this node as a JOIN. destination.setIncludeSubclasses( false ); // Don't include subclasses in the join. destination.setCollectionJoin( true ); // This is a clollection join. destination.setJoinSequence( collectionJoinSequence ); destination.setOrigin( origin, false ); destination.setCollectionTableAlias(tableAlias); // origin.addDestination( destination ); // This was the cause of HHH-242 // origin.setType( FROM_FRAGMENT ); // Set the parent node type so that the AST is properly formed. origin.setText( "" ); // The destination node will have all the FROM text. origin.setCollectionJoin( true ); // The parent node is a collection join too (voodoo - see JoinProcessor) fromClause.addCollectionJoinFromElementByPath( path, destination ); fromClause.getWalker().addQuerySpaces( queryableCollection.getCollectionSpaces() ); return destination; }
private FromElement createCollectionJoin(JoinSequence collectionJoinSequence, String tableAlias) throws SemanticException { String text = queryableCollection.getTableName(); AST ast = createFromElement( text ); FromElement destination = ( FromElement ) ast; Type elementType = queryableCollection.getElementType(); if ( elementType.isCollectionType() ) { throw new SemanticException( "Collections of collections are not supported!" ); } destination.initializeCollection( fromClause, classAlias, tableAlias ); destination.setType( JOIN_FRAGMENT ); // Tag this node as a JOIN. destination.setIncludeSubclasses( false ); // Don't include subclasses in the join. destination.setCollectionJoin( true ); // This is a clollection join. destination.setJoinSequence( collectionJoinSequence ); destination.setOrigin( origin, false ); destination.setCollectionTableAlias(tableAlias); // origin.addDestination( destination ); // This was the cause of HHH-242 // origin.setType( FROM_FRAGMENT ); // Set the parent node type so that the AST is properly formed. origin.setText( "" ); // The destination node will have all the FROM text. origin.setCollectionJoin( true ); // The parent node is a collection join too (voodoo - see JoinProcessor) fromClause.addCollectionJoinFromElementByPath( path, destination ); fromClause.getWalker().addQuerySpaces( queryableCollection.getCollectionSpaces() ); return destination; }