Package org.hibernate.engine.internal

Examples of org.hibernate.engine.internal.JoinSequence


    Iterator iter = joins.entrySet().iterator();
    while ( iter.hasNext() ) {
      Map.Entry me = ( Map.Entry ) iter.next();
      String name = ( String ) me.getKey();
      JoinSequence join = ( JoinSequence ) me.getValue();
      join.setSelector( new JoinSequence.Selector() {
        public boolean includeSubclasses(String alias) {
          boolean include = returnedTypes.contains( alias ) && !isShallowQuery();
          return include;
        }
      } );

      if ( typeMap.containsKey( name ) ) {
        ojf.addFragment( join.toJoinFragment( enabledFilters, true ) );
      }
      else if ( collections.containsKey( name ) ) {
        ojf.addFragment( join.toJoinFragment( enabledFilters, true ) );
      }
      else {
        //name from a super query (a bit inelegant that it shows up here)
      }
View Full Code Here


    String[] keyColumnNames = persister.getKeyColumnNames();
    //if (keyColumnNames.length!=1) throw new QueryException("composite-key collection in filter: " + collectionRole);

    String collectionName;
    JoinSequence join = new JoinSequence( getFactory() );
    collectionName = persister.isOneToMany() ?
        elementName :
        createNameForCollection( collectionRole );
    join.setRoot( persister, collectionName );
    if ( !persister.isOneToMany() ) {
      //many-to-many
      addCollection( collectionName, collectionRole );
      try {
        join.addJoin( ( AssociationType ) persister.getElementType(),
            elementName,
            JoinType.INNER_JOIN,
            persister.getElementColumnNames(collectionName) );
      }
      catch ( MappingException me ) {
        throw new QueryException( me );
      }
    }
    join.addCondition( collectionName, keyColumnNames, " = ?" );
    //if ( persister.hasWhere() ) join.addCondition( persister.getSQLWhereString(collectionName) );
    EntityType elemType = ( EntityType ) collectionElementType;
    addFrom( elementName, elemType.getAssociatedEntityName(), join );

  }
View Full Code Here

   * Generate an empty join sequence instance.
   *
   * @return The generate join sequence.
   */
  public JoinSequence createJoinSequence() {
    return new JoinSequence( sfi );
  }
View Full Code Here

   * @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;
  }
View Full Code Here

   * @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;
View Full Code Here

    boolean useFoundFromElement = found && ( elem.isImplied() || areSame( classAlias, elem.getClassAlias() ) );

    if ( ! useFoundFromElement ) {
      // If this is an implied join in a from element, then use the impled join type which is part of the
      // tree parser's state (set by the gramamar actions).
      JoinSequence joinSequence = getSessionFactoryHelper()
        .createJoinSequence( impliedJoin, propertyType, tableAlias, joinType, joinColumns );

      // If the lhs of the join is a "component join", we need to go back to the
      // first non-component-join as the origin to properly link aliases and
      // join columns
View Full Code Here

  }

  FromElement createCollectionElementsJoin(
          QueryableCollection queryableCollection,
          String collectionName) throws SemanticException {
    JoinSequence collectionJoinSequence = fromClause.getSessionFactoryHelper()
            .createCollectionJoinSequence( queryableCollection, collectionName );
    this.queryableCollection = queryableCollection;
    return createCollectionJoin( collectionJoinSequence, null );
  }
View Full Code Here

    Type elementType = queryableCollection.getElementType();
    if ( elementType.isEntityType() ) {       // A collection of entities...
      elem = createEntityAssociation( role, roleAlias, joinType );
    }
    else if ( elementType.isComponentType() ) {    // A collection of components...
      JoinSequence joinSequence = createJoinSequence( roleAlias, joinType );
      elem = createCollectionJoin( joinSequence, roleAlias );
    }
    else {                      // A collection of scalar elements...
      JoinSequence joinSequence = createJoinSequence( roleAlias, joinType );
      elem = createCollectionJoin( joinSequence, roleAlias );
    }

    elem.setRole( role );
    elem.setQueryableCollection( queryableCollection );
View Full Code Here

    String[] targetColumns = sfh.getCollectionElementColumns( role, roleAlias );
    AssociationType elementAssociationType = sfh.getElementAssociationType( type );

    // Create the join element under the from element.
    JoinType joinType = JoinType.INNER_JOIN;
    JoinSequence joinSequence = sfh.createJoinSequence( implied, elementAssociationType, tableAlias, joinType, targetColumns );
    elem = initializeJoin( path, destination, joinSequence, targetColumns, origin, false );
    elem.setUseFromFragment( true )// The associated entity is implied, but it must be included in the FROM.
    elem.setCollectionTableAlias( roleAlias )// The collection alias is the role.
    return elem;
  }
View Full Code Here

    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 );
View Full Code Here

TOP

Related Classes of org.hibernate.engine.internal.JoinSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.