Package org.hibernate.loader

Examples of org.hibernate.loader.DefaultEntityAliases


      else if ( queryReturns[i] instanceof NativeSQLQueryRootReturn ) {
        NativeSQLQueryRootReturn rtn = ( NativeSQLQueryRootReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        EntityAliases entityAliases;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          entityAliases = new DefaultEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        else {
          entityAliases = new ColumnEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        RootReturn customReturn = new RootReturn(
            alias,
            rtn.getReturnEntityName(),
            entityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        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 ),
                persister,
                ( 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 ),
                persister
            );
            if ( isEntityElements ) {
              elementEntityAliases = new ColumnEntityAliases(
                  ( Map ) entityPropertyResultMaps.get( alias ),
                  ( SQLLoadable ) alias2Persister.get( alias ),
                  ( String ) alias2Suffix.get( alias )
              );
            }
          }
          customReturn = new CollectionFetchReturn(
              alias,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              collectionAliases,
                  elementEntityAliases,
              rtn.getLockMode()
          );
        }
        else {
          EntityAliases entityAliases;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            entityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
View Full Code Here


      else if ( queryReturns[i] instanceof NativeSQLQueryRootReturn ) {
        NativeSQLQueryRootReturn rtn = ( NativeSQLQueryRootReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        EntityAliases entityAliases;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          entityAliases = new DefaultEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        else {
          entityAliases = new ColumnEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        RootReturn customReturn = new RootReturn(
            alias,
            rtn.getReturnEntityName(),
            entityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        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 ),
                persister,
                ( 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 ),
                persister
            );
            if ( isEntityElements ) {
              elementEntityAliases = new ColumnEntityAliases(
                  ( Map ) entityPropertyResultMaps.get( alias ),
                  ( SQLLoadable ) alias2Persister.get( alias ),
                  ( String ) alias2Suffix.get( alias )
              );
            }
          }
          customReturn = new CollectionFetchReturn(
              alias,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              collectionAliases,
                  elementEntityAliases,
              rtn.getLockMode()
          );
        }
        else {
          EntityAliases entityAliases;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            entityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
View Full Code Here

  private String createTableAlias(String name) {
    return StringHelper.generateAlias( name, currentTableAliasSuffix++ );
  }

  private EntityAliases createEntityAliases(EntityPersister entityPersister) {
    return new DefaultEntityAliases( (Loadable) entityPersister, createSuffix() );
  }
View Full Code Here

      else if ( queryReturns[i] instanceof NativeSQLQueryRootReturn ) {
        NativeSQLQueryRootReturn rtn = ( NativeSQLQueryRootReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        EntityAliases entityAliases;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          entityAliases = new DefaultEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        else {
          entityAliases = new ColumnEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        RootReturn customReturn = new RootReturn(
            alias,
            rtn.getReturnEntityName(),
            entityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        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 ),
                persister,
                ( 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 ),
                persister
            );
            if ( isEntityElements ) {
              elementEntityAliases = new ColumnEntityAliases(
                  ( Map ) entityPropertyResultMaps.get( alias ),
                  ( SQLLoadable ) alias2Persister.get( alias ),
                  ( String ) alias2Suffix.get( alias )
              );
            }
          }
          customReturn = new CollectionFetchReturn(
              alias,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              collectionAliases,
                  elementEntityAliases,
              rtn.getLockMode()
          );
        }
        else {
          EntityAliases entityAliases;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            entityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
View Full Code Here

      else if ( queryReturns[i] instanceof NativeSQLQueryRootReturn ) {
        NativeSQLQueryRootReturn rtn = ( NativeSQLQueryRootReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        EntityAliases entityAliases;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          entityAliases = new DefaultEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        else {
          entityAliases = new ColumnEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        RootReturn customReturn = new RootReturn(
            alias,
            rtn.getReturnEntityName(),
            entityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        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 ),
                persister,
                ( 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 ),
                persister
            );
            if ( isEntityElements ) {
              elementEntityAliases = new ColumnEntityAliases(
                  ( Map ) entityPropertyResultMaps.get( alias ),
                  ( SQLLoadable ) alias2Persister.get( alias ),
                  ( String ) alias2Suffix.get( alias )
              );
            }
          }
          customReturn = new CollectionFetchReturn(
              alias,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              collectionAliases,
                  elementEntityAliases,
              rtn.getLockMode()
          );
        }
        else {
          EntityAliases entityAliases;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            entityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
View Full Code Here

      else if ( queryReturns[i] instanceof NativeSQLQueryRootReturn ) {
        NativeSQLQueryRootReturn rtn = ( NativeSQLQueryRootReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        EntityAliases entityAliases;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          entityAliases = new DefaultEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        else {
          entityAliases = new ColumnEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        RootReturn customReturn = new RootReturn(
            alias,
            rtn.getReturnEntityName(),
            entityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        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 ),
                persister,
                ( 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 ),
                persister
            );
            if ( isEntityElements ) {
              elementEntityAliases = new ColumnEntityAliases(
                  ( Map ) entityPropertyResultMaps.get( alias ),
                  ( SQLLoadable ) alias2Persister.get( alias ),
                  ( String ) alias2Suffix.get( alias )
              );
            }
          }
          customReturn = new CollectionFetchReturn(
              alias,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              collectionAliases,
                  elementEntityAliases,
              rtn.getLockMode()
          );
        }
        else {
          EntityAliases entityAliases;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            entityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
View Full Code Here

      else if ( queryReturn instanceof NativeSQLQueryRootReturn ) {
        NativeSQLQueryRootReturn rtn = (NativeSQLQueryRootReturn) queryReturn;
        String alias = rtn.getAlias();
        EntityAliases entityAliases;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          entityAliases = new DefaultEntityAliases(
              (Map) entityPropertyResultMaps.get( alias ),
              (SQLLoadable) alias2Persister.get( alias ),
              (String) alias2Suffix.get( alias )
          );
        }
        else {
          entityAliases = new ColumnEntityAliases(
              (Map) entityPropertyResultMaps.get( alias ),
              (SQLLoadable) alias2Persister.get( alias ),
              (String) alias2Suffix.get( alias )
          );
        }
        RootReturn customReturn = new RootReturn(
            alias,
            rtn.getReturnEntityName(),
            entityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        customReturnsByAlias.put( rtn.getAlias(), customReturn );
      }
      else if ( queryReturn instanceof NativeSQLQueryCollectionReturn ) {
        NativeSQLQueryCollectionReturn rtn = (NativeSQLQueryCollectionReturn) queryReturn;
        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 ( queryReturn instanceof NativeSQLQueryJoinReturn ) {
        NativeSQLQueryJoinReturn rtn = (NativeSQLQueryJoinReturn) queryReturn;
        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 ),
                persister,
                (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 ),
                persister
            );
            if ( isEntityElements ) {
              elementEntityAliases = new ColumnEntityAliases(
                  (Map) entityPropertyResultMaps.get( alias ),
                  (SQLLoadable) alias2Persister.get( alias ),
                  (String) alias2Suffix.get( alias )
              );
            }
          }
          customReturn = new CollectionFetchReturn(
              alias,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              collectionAliases,
              elementEntityAliases,
              rtn.getLockMode()
          );
        }
        else {
          EntityAliases entityAliases;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            entityAliases = new DefaultEntityAliases(
                (Map) entityPropertyResultMaps.get( alias ),
                (SQLLoadable) alias2Persister.get( alias ),
                (String) alias2Suffix.get( alias )
            );
          }
View Full Code Here

      else if ( queryReturns[i] instanceof NativeSQLQueryRootReturn ) {
        NativeSQLQueryRootReturn rtn = ( NativeSQLQueryRootReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        EntityAliases entityAliases;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          entityAliases = new DefaultEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        else {
          entityAliases = new ColumnEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        RootReturn customReturn = new RootReturn(
            alias,
            rtn.getReturnEntityName(),
            entityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        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 ),
                persister,
                ( 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 ),
                persister
            );
            if ( isEntityElements ) {
              elementEntityAliases = new ColumnEntityAliases(
                  ( Map ) entityPropertyResultMaps.get( alias ),
                  ( SQLLoadable ) alias2Persister.get( alias ),
                  ( String ) alias2Suffix.get( alias )
              );
            }
          }
          customReturn = new CollectionFetchReturn(
              alias,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              collectionAliases,
                  elementEntityAliases,
              rtn.getLockMode()
          );
        }
        else {
          EntityAliases entityAliases;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            entityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
View Full Code Here

      else if ( queryReturns[i] instanceof NativeSQLQueryRootReturn ) {
        NativeSQLQueryRootReturn rtn = ( NativeSQLQueryRootReturn ) queryReturns[i];
        String alias = rtn.getAlias();
        EntityAliases entityAliases;
        if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
          entityAliases = new DefaultEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        else {
          entityAliases = new ColumnEntityAliases(
              ( Map ) entityPropertyResultMaps.get( alias ),
              ( SQLLoadable ) alias2Persister.get( alias ),
              ( String ) alias2Suffix.get( alias )
          );
        }
        RootReturn customReturn = new RootReturn(
            alias,
            rtn.getReturnEntityName(),
            entityAliases,
            rtn.getLockMode()
        );
        customReturns.add( customReturn );
        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 ),
                persister,
                ( 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 ),
                persister
            );
            if ( isEntityElements ) {
              elementEntityAliases = new ColumnEntityAliases(
                  ( Map ) entityPropertyResultMaps.get( alias ),
                  ( SQLLoadable ) alias2Persister.get( alias ),
                  ( String ) alias2Suffix.get( alias )
              );
            }
          }
          customReturn = new CollectionFetchReturn(
              alias,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              collectionAliases,
                  elementEntityAliases,
              rtn.getLockMode()
          );
        }
        else {
          EntityAliases entityAliases;
          if ( queryHadAliases || hasPropertyResultMap( alias ) ) {
            entityAliases = new DefaultEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
View Full Code Here

  private String createTableAlias(String name) {
    return StringHelper.generateAlias( name, currentTableAliasSuffix++ );
  }

  private EntityAliases createEntityAliases(EntityPersister entityPersister) {
    return new DefaultEntityAliases( (Loadable) entityPersister, createSuffix() );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.loader.DefaultEntityAliases

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.