Package org.hibernate.persister.collection

Examples of org.hibernate.persister.collection.SQLLoadableCollection


        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturns[i] instanceof NativeSQLQueryCollectionReturn ) {
        NativeSQLQueryCollectionReturn rtn = ( NativeSQLQueryCollectionReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        SQLLoadableCollection persister = ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
        boolean isEntityElements = persister.getElementType().isEntityType();
        CollectionAliases collectionAliases;
        EntityAliases elementEntityAliases = null;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          collectionAliases = new GeneratedCollectionAliases(
              ( Map ) collectionPropertyResultMaps.get( alias ),
              ( SQLLoadableCollection ) alias2CollectionPersister.get( alias ),
              ( String ) alias2CollectionSuffix.get( alias )
          );
          if ( isEntityElements ) {
            elementEntityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
        }
        else {
          collectionAliases = new ColumnCollectionAliases(
              ( Map ) collectionPropertyResultMaps.get( alias ),
              ( SQLLoadableCollection ) alias2CollectionPersister.get( alias )
          );
          if ( isEntityElements ) {
            elementEntityAliases = new ColumnEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
        }
        CollectionReturn customReturn = new CollectionReturn(
            alias,
            rtn.getOwnerEntityName(),
            rtn.getOwnerProperty(),
            collectionAliases,
                elementEntityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturns[i] instanceof NativeSQLQueryJoinReturn ) {
        NativeSQLQueryJoinReturn rtn = ( NativeSQLQueryJoinReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        FetchReturn customReturn;
        NonScalarReturn ownerCustomReturn = ( NonScalarReturn ) customReturnsByAlias.get( rtn.getOwnerAlias() );
        if ( alias2CollectionPersister.containsKey( alias ) ) {
          SQLLoadableCollection persister = ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
          boolean isEntityElements = persister.getElementType().isEntityType();
          CollectionAliases collectionAliases;
          EntityAliases elementEntityAliases = null;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            collectionAliases = new GeneratedCollectionAliases(
                ( Map ) collectionPropertyResultMaps.get( alias ),
View Full Code Here


    alias2Suffix.put( alias, suffix );
    entityPropertyResultMaps.put( alias, propertyResult );
  }

  private void addCollection(String role, String alias, Map propertyResults) {
    SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getCollectionPersister( role );
    alias2CollectionPersister.put( alias, collectionPersister );
    String suffix = generateCollectionSuffix();
    log.trace( "mapping alias [" + alias + "] to collection-suffix [" + suffix + "]" );
    alias2CollectionSuffix.put( alias, suffix );
    collectionPropertyResultMaps.put( alias, propertyResults );

    if ( collectionPersister.isOneToMany() ) {
      SQLLoadable persister = ( SQLLoadable ) collectionPersister.getElementPersister();
      addPersister( alias, filter( propertyResults ), persister );
    }
  }
View Full Code Here

        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturns[i] instanceof NativeSQLQueryCollectionReturn ) {
        NativeSQLQueryCollectionReturn rtn = ( NativeSQLQueryCollectionReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        SQLLoadableCollection persister = ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
        boolean isEntityElements = persister.getElementType().isEntityType();
        CollectionAliases collectionAliases;
        EntityAliases elementEntityAliases = null;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          collectionAliases = new GeneratedCollectionAliases(
              ( Map ) collectionPropertyResultMaps.get( alias ),
              ( SQLLoadableCollection ) alias2CollectionPersister.get( alias ),
              ( String ) alias2CollectionSuffix.get( alias )
          );
          if ( isEntityElements ) {
            elementEntityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
        }
        else {
          collectionAliases = new ColumnCollectionAliases(
              ( Map ) collectionPropertyResultMaps.get( alias ),
              ( SQLLoadableCollection ) alias2CollectionPersister.get( alias )
          );
          if ( isEntityElements ) {
            elementEntityAliases = new ColumnEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
        }
        CollectionReturn customReturn = new CollectionReturn(
            alias,
            rtn.getOwnerEntityName(),
            rtn.getOwnerProperty(),
            collectionAliases,
                elementEntityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturns[i] instanceof NativeSQLQueryJoinReturn ) {
        NativeSQLQueryJoinReturn rtn = ( NativeSQLQueryJoinReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        FetchReturn customReturn;
        NonScalarReturn ownerCustomReturn = ( NonScalarReturn ) customReturnsByAlias.get( rtn.getOwnerAlias() );
        if ( alias2CollectionPersister.containsKey( alias ) ) {
          SQLLoadableCollection persister = ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
          boolean isEntityElements = persister.getElementType().isEntityType();
          CollectionAliases collectionAliases;
          EntityAliases elementEntityAliases = null;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            collectionAliases = new GeneratedCollectionAliases(
                ( Map ) collectionPropertyResultMaps.get( alias ),
View Full Code Here

    alias2Suffix.put( alias, suffix );
    entityPropertyResultMaps.put( alias, propertyResult );
  }

  private void addCollection(String role, String alias, Map propertyResults) {
    SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getCollectionPersister( role );
    alias2CollectionPersister.put( alias, collectionPersister );
    String suffix = generateCollectionSuffix();
    log.trace( "mapping alias [" + alias + "] to collection-suffix [" + suffix + "]" );
    alias2CollectionSuffix.put( alias, suffix );
    collectionPropertyResultMaps.put( alias, propertyResults );

    if ( collectionPersister.isOneToMany() || collectionPersister.isManyToMany() ) {
      SQLLoadable persister = ( SQLLoadable ) collectionPersister.getElementPersister();
      addPersister( alias, filter( propertyResults ), persister );
    }
  }
View Full Code Here

  private String resolveCollectionProperties(
      String aliasName,
      String propertyName) {

    Map fieldResults = context.getPropertyResultsMapByAlias( aliasName );
    SQLLoadableCollection collectionPersister = context.getCollectionPersisterByAlias( aliasName );
    String collectionSuffix = context.getCollectionSuffixByAlias( aliasName );

    if ( "*".equals( propertyName ) ) {
      if( !fieldResults.isEmpty() ) {
        throw new QueryException("Using return-propertys together with * syntax is not supported.");
      }
     
      String selectFragment = collectionPersister.selectFragment( aliasName, collectionSuffix );
      aliasesFound++;
      return selectFragment
            + ", "
            + resolveProperties( aliasName, propertyName );
    }
    else if ( "element.*".equals( propertyName ) ) {
      return resolveProperties( aliasName, "*" );
    }
    else {
      String[] columnAliases;

      // Let return-propertys override whatever the persister has for aliases.
      columnAliases = ( String[] ) fieldResults.get(propertyName);
      if ( columnAliases==null ) {
        columnAliases = collectionPersister.getCollectionPropertyColumnAliases( propertyName, collectionSuffix );
      }
     
      if ( columnAliases == null || columnAliases.length == 0 ) {
        throw new QueryException(
            "No column name found for property [" + propertyName + "] for alias [" + aliasName + "]",
View Full Code Here

  private String resolveCollectionProperties(
      String aliasName,
      String propertyName) {

    Map fieldResults = context.getPropertyResultsMapByAlias( aliasName );
    SQLLoadableCollection collectionPersister = context.getCollectionPersisterByAlias( aliasName );
    String collectionSuffix = context.getCollectionSuffixByAlias( aliasName );

    if ( "*".equals( propertyName ) ) {
      if( !fieldResults.isEmpty() ) {
        throw new QueryException("Using return-propertys together with * syntax is not supported.");
      }
     
      String selectFragment = collectionPersister.selectFragment( aliasName, collectionSuffix );
      aliasesFound++;
      return selectFragment
            + ", "
            + resolveProperties( aliasName, propertyName );
    }
    else if ( "element.*".equals( propertyName ) ) {
      return resolveProperties( aliasName, "*" );
    }
    else {
      String[] columnAliases;

      // Let return-propertys override whatever the persister has for aliases.
      columnAliases = ( String[] ) fieldResults.get(propertyName);
      if ( columnAliases==null ) {
        columnAliases = collectionPersister.getCollectionPropertyColumnAliases( propertyName, collectionSuffix );
      }
     
      if ( columnAliases == null || columnAliases.length == 0 ) {
        throw new QueryException(
            "No column name found for property [" + propertyName + "] for alias [" + aliasName + "]",
View Full Code Here

  private String resolveCollectionProperties(
      String aliasName,
      String propertyName) {

    Map fieldResults = context.getPropertyResultsMapByAlias( aliasName );
    SQLLoadableCollection collectionPersister = context.getCollectionPersisterByAlias( aliasName );
    String collectionSuffix = context.getCollectionSuffixByAlias( aliasName );

    if ( "*".equals( propertyName ) ) {
      if( !fieldResults.isEmpty() ) {
        throw new QueryException("Using return-propertys together with * syntax is not supported.");
      }
     
      String selectFragment = collectionPersister.selectFragment( aliasName, collectionSuffix );
      aliasesFound++;
      return selectFragment
            + ", "
            + resolveProperties( aliasName, propertyName );
    }
    else if ( "element.*".equals( propertyName ) ) {
      return resolveProperties( aliasName, "*" );
    }
    else {
      String[] columnAliases;

      // Let return-propertys override whatever the persister has for aliases.
      columnAliases = ( String[] ) fieldResults.get(propertyName);
      if ( columnAliases==null ) {
        columnAliases = collectionPersister.getCollectionPropertyColumnAliases( propertyName, collectionSuffix );
      }
     
      if ( columnAliases == null || columnAliases.length == 0 ) {
        throw new QueryException(
            "No column name found for property [" + propertyName + "] for alias [" + aliasName + "]",
View Full Code Here

        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturns[i] instanceof NativeSQLQueryCollectionReturn ) {
        NativeSQLQueryCollectionReturn rtn = ( NativeSQLQueryCollectionReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        SQLLoadableCollection persister = ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
        boolean isEntityElements = persister.getElementType().isEntityType();
        CollectionAliases collectionAliases;
        EntityAliases elementEntityAliases = null;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          collectionAliases = new GeneratedCollectionAliases(
              ( Map ) collectionPropertyResultMaps.get( alias ),
              ( SQLLoadableCollection ) alias2CollectionPersister.get( alias ),
              ( String ) alias2CollectionSuffix.get( alias )
          );
          if ( isEntityElements ) {
            elementEntityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
        }
        else {
          collectionAliases = new ColumnCollectionAliases(
              ( Map ) collectionPropertyResultMaps.get( alias ),
              ( SQLLoadableCollection ) alias2CollectionPersister.get( alias )
          );
          if ( isEntityElements ) {
            elementEntityAliases = new ColumnEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
        }
        CollectionReturn customReturn = new CollectionReturn(
            alias,
            rtn.getOwnerEntityName(),
            rtn.getOwnerProperty(),
            collectionAliases,
                elementEntityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturns[i] instanceof NativeSQLQueryJoinReturn ) {
        NativeSQLQueryJoinReturn rtn = ( NativeSQLQueryJoinReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        FetchReturn customReturn;
        NonScalarReturn ownerCustomReturn = ( NonScalarReturn ) customReturnsByAlias.get( rtn.getOwnerAlias() );
        if ( alias2CollectionPersister.containsKey( alias ) ) {
          SQLLoadableCollection persister = ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
          boolean isEntityElements = persister.getElementType().isEntityType();
          CollectionAliases collectionAliases;
          EntityAliases elementEntityAliases = null;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            collectionAliases = new GeneratedCollectionAliases(
                ( Map ) collectionPropertyResultMaps.get( alias ),
View Full Code Here

    alias2Suffix.put( alias, suffix );
    entityPropertyResultMaps.put( alias, propertyResult );
  }

  private void addCollection(String role, String alias, Map propertyResults) {
    SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getCollectionPersister( role );
    alias2CollectionPersister.put( alias, collectionPersister );
    String suffix = generateCollectionSuffix();
    log.trace( "mapping alias [" + alias + "] to collection-suffix [" + suffix + "]" );
    alias2CollectionSuffix.put( alias, suffix );
    collectionPropertyResultMaps.put( alias, propertyResults );

    if ( collectionPersister.isOneToMany() ) {
      SQLLoadable persister = ( SQLLoadable ) collectionPersister.getElementPersister();
      addPersister( alias, filter( propertyResults ), persister );
    }
  }
View Full Code Here

        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturns[i] instanceof NativeSQLQueryCollectionReturn ) {
        NativeSQLQueryCollectionReturn rtn = ( NativeSQLQueryCollectionReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        SQLLoadableCollection persister = ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
        boolean isEntityElements = persister.getElementType().isEntityType();
        CollectionAliases collectionAliases;
        EntityAliases elementEntityAliases = null;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          collectionAliases = new GeneratedCollectionAliases(
              ( Map ) collectionPropertyResultMaps.get( alias ),
              ( SQLLoadableCollection ) alias2CollectionPersister.get( alias ),
              ( String ) alias2CollectionSuffix.get( alias )
          );
          if ( isEntityElements ) {
            elementEntityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
        }
        else {
          collectionAliases = new ColumnCollectionAliases(
              ( Map ) collectionPropertyResultMaps.get( alias ),
              ( SQLLoadableCollection ) alias2CollectionPersister.get( alias )
          );
          if ( isEntityElements ) {
            elementEntityAliases = new ColumnEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
        }
        CollectionReturn customReturn = new CollectionReturn(
            alias,
            rtn.getOwnerEntityName(),
            rtn.getOwnerProperty(),
            collectionAliases,
                elementEntityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturns[i] instanceof NativeSQLQueryJoinReturn ) {
        NativeSQLQueryJoinReturn rtn = ( NativeSQLQueryJoinReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        FetchReturn customReturn;
        NonScalarReturn ownerCustomReturn = ( NonScalarReturn ) customReturnsByAlias.get( rtn.getOwnerAlias() );
        if ( alias2CollectionPersister.containsKey( alias ) ) {
          SQLLoadableCollection persister = ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
          boolean isEntityElements = persister.getElementType().isEntityType();
          CollectionAliases collectionAliases;
          EntityAliases elementEntityAliases = null;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            collectionAliases = new GeneratedCollectionAliases(
                ( Map ) collectionPropertyResultMaps.get( alias ),
View Full Code Here

TOP

Related Classes of org.hibernate.persister.collection.SQLLoadableCollection

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.