/** * Create a join sequence rooted at the given collection. * * @param collPersister The persister for the collection at which the join should be rooted. * @param collectionName The alias to use for qualifying column references. * * @return The generated join sequence. */ public JoinSequence createCollectionJoinSequence(QueryableCollection collPersister, String collectionName) { JoinSequence joinSequence = createJoinSequence(); joinSequence.setRoot( collPersister, collectionName ); joinSequence.setUseThetaStyle( true ); // TODO: figure out how this should be set. /////////////////////////////////////////////////////////////////////////////// // This was the reason for failures regarding INDEX_OP and subclass joins on // theta-join dialects; not sure what behavior we were trying to emulate ;) // joinSequence = joinSequence.getFromPart(); // Emulate the old addFromOnly behavior. return joinSequence; }
public void start(QueryTranslatorImpl q) { if ( !continuation ) { reset( q ); path.setLength( 0 ); joinSequence = new JoinSequence( q.getFactory() ).setUseThetaStyle( useThetaStyleJoin ); } }
/** * Generate a join sequence representing the given association type. * * @param implicit Should implicit joins (theta-style) or explicit joins (ANSI-style) be rendered * @param associationType The type representing the thing to be joined into. * @param tableAlias The table alias to use in qualifying the join conditions * @param joinType The type of join to render (inner, outer, etc); see {@link org.hibernate.sql.JoinFragment} * @param columns The columns making up the condition of the join. * * @return The generated join sequence. */ public JoinSequence createJoinSequence(boolean implicit, AssociationType associationType, String tableAlias, JoinType joinType, String[][] columns) { JoinSequence joinSequence = createJoinSequence(); joinSequence.setUseThetaStyle( implicit ); // Implicit joins use theta style (WHERE pk = fk), explicit joins use JOIN (afterQuery from) joinSequence.addJoin( associationType, tableAlias, joinType, columns ); return joinSequence; }
/** * Generate a join sequence representing the given association type. * * @param implicit Should implicit joins (theta-style) or explicit joins (ANSI-style) be rendered * @param associationType The type representing the thing to be joined into. * @param tableAlias The table alias to use in qualifying the join conditions * @param joinType The type of join to render (inner, outer, etc); see {@link org.hibernate.sql.JoinFragment} * @param columns The columns making up the condition of the join. * * @return The generated join sequence. */ public JoinSequence createJoinSequence(boolean implicit, AssociationType associationType, String tableAlias, JoinType joinType, String[] columns) { JoinSequence joinSequence = createJoinSequence(); joinSequence.setUseThetaStyle( implicit ); // Implicit joins use theta style (WHERE pk = fk), explicit joins use JOIN (after from) joinSequence.addJoin( associationType, tableAlias, joinType, columns ); return joinSequence; }
@Override public String[] toColumns(final String tableAlias) { if ( propertyName.equalsIgnoreCase( "index" ) ) { return collectionPropertyMapping.toColumns( tableAlias, propertyName ); } Map enabledFilters = fromElement.getWalker().getEnabledFilters(); String subquery = CollectionSubqueryFactory.createCollectionSubquery( joinSequence.copyForCollectionProperty().setUseThetaStyle( true ), enabledFilters, collectionPropertyMapping.toColumns( tableAlias, propertyName ) ); LOG.debugf( "toColumns(%s,%s) : subquery = %s", tableAlias, propertyName, subquery ); return new String[] {"(" + subquery + ")"}; } };
joinSequence.setUseThetaStyle( false ); elem.setUseFromFragment( true ); elem.setImpliedInFromClause( true ); joinSequence.setUseThetaStyle( true ); elem.setUseFromFragment( false );
private void prepareForIndex(QueryTranslatorImpl q) throws QueryException { QueryableCollection collPersister = q.getCollectionPersister( collectionRole ); if ( !collPersister.hasIndex() ) { throw new QueryException( "unindexed collection before []: " + path ); } String[] indexCols = collPersister.getIndexColumnNames(); if ( indexCols.length != 1 ) { throw new QueryException( "composite-index appears in []: " + path ); } //String[] keyCols = collPersister.getKeyColumnNames(); JoinSequence fromJoins = new JoinSequence( q.getFactory() ) .setUseThetaStyle( useThetaStyleJoin ) .setRoot( collPersister, collectionName ) .setNext( joinSequence.copy() ); if ( !continuation ) { addJoin( collectionName, collPersister.getCollectionType() ); } joinSequence.addCondition( collectionName + '.' + indexCols[0] + " = " ); //TODO: get SQL rendering out of here CollectionElement elem = new CollectionElement(); elem.elementColumns = collPersister.getElementColumnNames(collectionName); elem.elementType = collPersister.getElementType(); elem.isOneToMany = collPersister.isOneToMany(); elem.alias = collectionName; elem.joinSequence = joinSequence; collectionElements.addLast( elem ); setExpectingCollectionIndex(); q.addCollection( collectionName, collectionRole ); q.addFromJoinOnly( collectionName, fromJoins ); }
( join.isThetaStyle() || StringHelper.isNotEmpty( whereFrag ) ) ) { fromElement.setType( FROM_FRAGMENT ); fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
fromElement.setIncludeSubclasses( true ); // Tell the destination fromElement to 'includeSubclasses'. if ( useThetaStyleImplicitJoins ) { fromElement.getJoinSequence().setUseThetaStyle( true ); // Use theta style (for regression)
public void start(QueryTranslatorImpl q) { if ( !continuation ) { reset( q ); path.setLength( 0 ); joinSequence = new JoinSequence( q.getFactory() ).setUseThetaStyle( useThetaStyleJoin ); } }
public void start(QueryTranslatorImpl q) { if ( !continuation ) { reset( q ); path.setLength( 0 ); joinSequence = new JoinSequence( q.getFactory() ).setUseThetaStyle( useThetaStyleJoin ); } }
/** * Generate a join sequence representing the given association type. * * @param implicit Should implicit joins (theta-style) or explicit joins (ANSI-style) be rendered * @param associationType The type representing the thing to be joined into. * @param tableAlias The table alias to use in qualifying the join conditions * @param joinType The type of join to render (inner, outer, etc); see {@link org.hibernate.sql.JoinFragment} * @param columns The columns making up the condition of the join. * @return The generated join sequence. */ public JoinSequence createJoinSequence(boolean implicit, AssociationType associationType, String tableAlias, JoinType joinType, String[] columns) { JoinSequence joinSequence = createJoinSequence(); joinSequence.setUseThetaStyle( implicit ); // Implicit joins use theta style (WHERE pk = fk), explicit joins use JOIN (after from) joinSequence.addJoin( associationType, tableAlias, joinType, columns ); return joinSequence; }
/** * Generate a join sequence representing the given association type. * * @param implicit Should implicit joins (theta-style) or explicit joins (ANSI-style) be rendered * @param associationType The type representing the thing to be joined into. * @param tableAlias The table alias to use in qualifying the join conditions * @param joinType The type of join to render (inner, outer, etc); see {@link org.hibernate.sql.JoinFragment} * @param columns The columns making up the condition of the join. * @return The generated join sequence. */ public JoinSequence createJoinSequence(boolean implicit, AssociationType associationType, String tableAlias, JoinType joinType, String[] columns) { JoinSequence joinSequence = createJoinSequence(); joinSequence.setUseThetaStyle( implicit ); // Implicit joins use theta style (WHERE pk = fk), explicit joins use JOIN (after from) joinSequence.addJoin( associationType, tableAlias, joinType, columns ); return joinSequence; }
/** * Create a join sequence rooted at the given collection. * * @param collPersister The persister for the collection at which the join should be rooted. * @param collectionName The alias to use for qualifying column references. * @return The generated join sequence. */ public JoinSequence createCollectionJoinSequence(QueryableCollection collPersister, String collectionName) { JoinSequence joinSequence = createJoinSequence(); joinSequence.setRoot( collPersister, collectionName ); joinSequence.setUseThetaStyle( true ); // TODO: figure out how this should be set. /////////////////////////////////////////////////////////////////////////////// // This was the reason for failures regarding INDEX_OP and subclass joins on // theta-join dialects; not sure what behavior we were trying to emulate ;) // joinSequence = joinSequence.getFromPart(); // Emulate the old addFromOnly behavior. return joinSequence; }
/** * Create a join sequence rooted at the given collection. * * @param collPersister The persister for the collection at which the join should be rooted. * @param collectionName The alias to use for qualifying column references. * @return The generated join sequence. */ public JoinSequence createCollectionJoinSequence(QueryableCollection collPersister, String collectionName) { JoinSequence joinSequence = createJoinSequence(); joinSequence.setRoot( collPersister, collectionName ); joinSequence.setUseThetaStyle( true ); // TODO: figure out how this should be set. /////////////////////////////////////////////////////////////////////////////// // This was the reason for failures regarding INDEX_OP and subclass joins on // theta-join dialects; not sure what behavior we were trying to emulate ;) // joinSequence = joinSequence.getFromPart(); // Emulate the old addFromOnly behavior. return joinSequence; }
private void prepareForIndex(QueryTranslatorImpl q) throws QueryException { QueryableCollection collPersister = q.getCollectionPersister( collectionRole ); if ( !collPersister.hasIndex() ) throw new QueryException( "unindexed collection before []: " + path ); String[] indexCols = collPersister.getIndexColumnNames(); if ( indexCols.length != 1 ) throw new QueryException( "composite-index appears in []: " + path ); //String[] keyCols = collPersister.getKeyColumnNames(); JoinSequence fromJoins = new JoinSequence( q.getFactory() ) .setUseThetaStyle( useThetaStyleJoin ) .setRoot( collPersister, collectionName ) .setNext( joinSequence.copy() ); if ( !continuation ) addJoin( collectionName, collPersister.getCollectionType() ); joinSequence.addCondition( collectionName + '.' + indexCols[0] + " = " ); //TODO: get SQL rendering out of here CollectionElement elem = new CollectionElement(); elem.elementColumns = collPersister.getElementColumnNames(collectionName); elem.elementType = collPersister.getElementType(); elem.isOneToMany = collPersister.isOneToMany(); elem.alias = collectionName; elem.joinSequence = joinSequence; collectionElements.addLast( elem ); setExpectingCollectionIndex(); q.addCollection( collectionName, collectionRole ); q.addFromJoinOnly( collectionName, fromJoins ); }
private void prepareForIndex(QueryTranslatorImpl q) throws QueryException { QueryableCollection collPersister = q.getCollectionPersister( collectionRole ); if ( !collPersister.hasIndex() ) throw new QueryException( "unindexed collection before []: " + path ); String[] indexCols = collPersister.getIndexColumnNames(); if ( indexCols.length != 1 ) throw new QueryException( "composite-index appears in []: " + path ); //String[] keyCols = collPersister.getKeyColumnNames(); JoinSequence fromJoins = new JoinSequence( q.getFactory() ) .setUseThetaStyle( useThetaStyleJoin ) .setRoot( collPersister, collectionName ) .setNext( joinSequence.copy() ); if ( !continuation ) addJoin( collectionName, collPersister.getCollectionType() ); joinSequence.addCondition( collectionName + '.' + indexCols[0] + " = " ); //TODO: get SQL rendering out of here CollectionElement elem = new CollectionElement(); elem.elementColumns = collPersister.getElementColumnNames(collectionName); elem.elementType = collPersister.getElementType(); elem.isOneToMany = collPersister.isOneToMany(); elem.alias = collectionName; elem.joinSequence = joinSequence; collectionElements.addLast( elem ); setExpectingCollectionIndex(); q.addCollection( collectionName, collectionRole ); q.addFromJoinOnly( collectionName, fromJoins ); }
( join.isThetaStyle() || StringHelper.isNotEmpty( whereFrag ) ) ) { fromElement.setType( FROM_FRAGMENT ); fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
fromElement.setIncludeSubclasses( true ); // Tell the destination fromElement to 'includeSubclasses'. if ( useThetaStyleImplicitJoins ) { fromElement.getJoinSequence().setUseThetaStyle( true ); // Use theta style (for regression)
fromElement.setIncludeSubclasses( true ); // Tell the destination fromElement to 'includeSubclasses'. if ( useThetaStyleImplicitJoins ) { fromElement.getJoinSequence().setUseThetaStyle( true ); // Use theta style (for regression)