Package org.hibernate.engine.query.sql

Examples of org.hibernate.engine.query.sql.NativeSQLQueryCollectionReturn


        );
        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 )
            );
          }
          else {
            entityAliases = new ColumnEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
          customReturn = new EntityFetchReturn(
              alias,
              entityAliases,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              rtn.getLockMode()
          );
        }
        customReturns.add( customReturn );
        customReturnsByAlias.put( alias, customReturn );
      }
View Full Code Here


    check( true, r6, new NativeSQLQueryJoinReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE ) );
    check( true, r7, new NativeSQLQueryJoinReturn( "b", "c", "a", null, LockMode.NONE ) );
  }

  public void testNativeSQLQueryCollectionReturn() {
    NativeSQLQueryCollectionReturn r1 = new NativeSQLQueryCollectionReturn( "a", "b", "c", null, null);
    NativeSQLQueryCollectionReturn r2 = new NativeSQLQueryCollectionReturn( "a", "c", "b", null, null);
    NativeSQLQueryCollectionReturn r3NullMap = new NativeSQLQueryCollectionReturn( "b", "c", "a", null, null);
    NativeSQLQueryCollectionReturn r3EmptyMap= new NativeSQLQueryCollectionReturn( "b", "c", "a", new HashMap(), null);
    NativeSQLQueryCollectionReturn r4 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), null);
    NativeSQLQueryCollectionReturn r5 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "otherkey", "othervalue" ), null);
    NativeSQLQueryCollectionReturn r6 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE );
    NativeSQLQueryCollectionReturn r7 = new NativeSQLQueryCollectionReturn( "b", "c", "a", null, LockMode.NONE );

    check( false, r1, r2 );
    check( false, r1, r3NullMap );
    check( false, r1, r3EmptyMap );
    check( false, r1, r4 );
    check( false, r1, r5 );
    check( false, r1, r6 );
    check( false, r1, r7 );

    check( false, r2, r3NullMap );
    check( false, r2, r3EmptyMap );
    check( false, r2, r4 );
    check( false, r2, r5 );
    check( false, r2, r6 );
    check( false, r2, r7 );

    check( true, r3NullMap, r3EmptyMap );
    check( false, r3NullMap, r4 );
    check( false, r3NullMap, r5 );
    check( false, r3NullMap, r6 );
    check( false, r3NullMap, r7 );

    check( false, r3EmptyMap, r4 );
    check( false, r3EmptyMap, r5 );
    check( false, r3EmptyMap, r6 );
    check( false, r3EmptyMap, r7 );

    check( false, r4, r5 );
    check( false, r4, r6 );
    check( false, r4, r7 );

    check( false, r5, r6 );
    check( false, r5, r7 );

    check( false, r6, r7 );

    check( true, r1, new NativeSQLQueryCollectionReturn( "a", "b", "c", null, null) );
    check( true, r2, new NativeSQLQueryCollectionReturn( "a", "c", "b", null, null) );
    check( true, r3NullMap, new NativeSQLQueryCollectionReturn( "b", "c", "a", null, null) );
    check( true, r3EmptyMap, new NativeSQLQueryCollectionReturn( "b", "c", "a", new HashMap(), null) );
    check( true, r4, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), null) );
    check( true, r5, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "otherkey", "othervalue" ), null) );
    check( true, r6, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE ) );
    check( true, r7, new NativeSQLQueryCollectionReturn( "b", "c", "a", null, LockMode.NONE ) );
  }
View Full Code Here

  public void testNativeSQLQueryReturnTypes() {
    NativeSQLQueryScalarReturn r1 = new NativeSQLQueryScalarReturn( "a", sfi().getTypeResolver().basic( "int" ) );
    NativeSQLQueryRootReturn r2 = new NativeSQLQueryRootReturn( "a", "b", LockMode.NONE );
    NativeSQLQueryJoinReturn r3 = new NativeSQLQueryJoinReturn( "a", "b", "c", Collections.singletonMap( "key", "value" ), LockMode.NONE );
    NativeSQLQueryCollectionReturn r4 = new NativeSQLQueryCollectionReturn( "a", "b", "c", Collections.singletonMap( "key", "value" ), LockMode.NONE);

    check( false, r1, r2 );
    check( false, r1, r3 );
    check( false, r1, r4 );
View Full Code Here

    String ownerPropertyName = collectionAttribute.substring( dot + 1 );

    //FIXME: get the PersistentClass
    java.util.Map propertyResults = bindPropertyResults(alias, returnElem, null, mappings );

    return new NativeSQLQueryCollectionReturn(
        alias,
        ownerClassName,
        ownerPropertyName,
        propertyResults,
        lockMode
View Full Code Here

        );
        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 )
            );
          }
          else {
            entityAliases = new ColumnEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
          customReturn = new EntityFetchReturn(
              alias,
              entityAliases,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              rtn.getLockMode()
          );
        }
        customReturns.add( customReturn );
        customReturnsByAlias.put( alias, customReturn );
      }
View Full Code Here

        );
        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 )
            );
          }
          else {
            entityAliases = new ColumnEntityAliases(
                ( Map ) entityPropertyResultMaps.get( alias ),
                ( SQLLoadable ) alias2Persister.get( alias ),
                ( String ) alias2Suffix.get( alias )
            );
          }
          customReturn = new EntityFetchReturn(
              alias,
              entityAliases,
              ownerCustomReturn,
              rtn.getOwnerProperty(),
              rtn.getLockMode()
          );
        }
        customReturns.add( customReturn );
        customReturnsByAlias.put( alias, customReturn );
      }
View Full Code Here

    check( true, r6, new NativeSQLQueryJoinReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE ) );
    check( true, r7, new NativeSQLQueryJoinReturn( "b", "c", "a", null, LockMode.NONE ) );
  }

  public void testNativeSQLQueryCollectionReturn() {
    NativeSQLQueryCollectionReturn r1 = new NativeSQLQueryCollectionReturn( "a", "b", "c", null, null);
    NativeSQLQueryCollectionReturn r2 = new NativeSQLQueryCollectionReturn( "a", "c", "b", null, null);
    NativeSQLQueryCollectionReturn r3NullMap = new NativeSQLQueryCollectionReturn( "b", "c", "a", null, null);
    NativeSQLQueryCollectionReturn r3EmptyMap= new NativeSQLQueryCollectionReturn( "b", "c", "a", new HashMap(), null);
    NativeSQLQueryCollectionReturn r4 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), null);
    NativeSQLQueryCollectionReturn r5 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "otherkey", "othervalue" ), null);
    NativeSQLQueryCollectionReturn r6 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE );
    NativeSQLQueryCollectionReturn r7 = new NativeSQLQueryCollectionReturn( "b", "c", "a", null, LockMode.NONE );

    check( false, r1, r2 );
    check( false, r1, r3NullMap );
    check( false, r1, r3EmptyMap );
    check( false, r1, r4 );
    check( false, r1, r5 );
    check( false, r1, r6 );
    check( false, r1, r7 );

    check( false, r2, r3NullMap );
    check( false, r2, r3EmptyMap );
    check( false, r2, r4 );
    check( false, r2, r5 );
    check( false, r2, r6 );
    check( false, r2, r7 );

    check( true, r3NullMap, r3EmptyMap );
    check( false, r3NullMap, r4 );
    check( false, r3NullMap, r5 );
    check( false, r3NullMap, r6 );
    check( false, r3NullMap, r7 );

    check( false, r3EmptyMap, r4 );
    check( false, r3EmptyMap, r5 );
    check( false, r3EmptyMap, r6 );
    check( false, r3EmptyMap, r7 );

    check( false, r4, r5 );
    check( false, r4, r6 );
    check( false, r4, r7 );

    check( false, r5, r6 );
    check( false, r5, r7 );

    check( false, r6, r7 );

    check( true, r1, new NativeSQLQueryCollectionReturn( "a", "b", "c", null, null) );
    check( true, r2, new NativeSQLQueryCollectionReturn( "a", "c", "b", null, null) );
    check( true, r3NullMap, new NativeSQLQueryCollectionReturn( "b", "c", "a", null, null) );
    check( true, r3EmptyMap, new NativeSQLQueryCollectionReturn( "b", "c", "a", new HashMap(), null) );
    check( true, r4, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), null) );
    check( true, r5, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "otherkey", "othervalue" ), null) );
    check( true, r6, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE ) );
    check( true, r7, new NativeSQLQueryCollectionReturn( "b", "c", "a", null, LockMode.NONE ) );
  }
View Full Code Here

  public void testNativeSQLQueryReturnTypes() {
    NativeSQLQueryScalarReturn r1 = new NativeSQLQueryScalarReturn( "a", TypeFactory.basic( "int" ) );
    NativeSQLQueryRootReturn r2 = new NativeSQLQueryRootReturn( "a", "b", LockMode.NONE );
    NativeSQLQueryJoinReturn r3 = new NativeSQLQueryJoinReturn( "a", "b", "c", Collections.singletonMap( "key", "value" ), LockMode.NONE );
    NativeSQLQueryCollectionReturn r4 = new NativeSQLQueryCollectionReturn( "a", "b", "c", Collections.singletonMap( "key", "value" ), LockMode.NONE);

    check( false, r1, r2 );
    check( false, r1, r3 );
    check( false, r1, r4 );
View Full Code Here

    check( true, r6, new NativeSQLQueryJoinReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE ) );
    check( true, r7, new NativeSQLQueryJoinReturn( "b", "c", "a", null, LockMode.NONE ) );
  }

  public void testNativeSQLQueryCollectionReturn() {
    NativeSQLQueryCollectionReturn r1 = new NativeSQLQueryCollectionReturn( "a", "b", "c", null, null);
    NativeSQLQueryCollectionReturn r2 = new NativeSQLQueryCollectionReturn( "a", "c", "b", null, null);
    NativeSQLQueryCollectionReturn r3NullMap = new NativeSQLQueryCollectionReturn( "b", "c", "a", null, null);
    NativeSQLQueryCollectionReturn r3EmptyMap= new NativeSQLQueryCollectionReturn( "b", "c", "a", new HashMap(), null);
    NativeSQLQueryCollectionReturn r4 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), null);
    NativeSQLQueryCollectionReturn r5 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "otherkey", "othervalue" ), null);
    NativeSQLQueryCollectionReturn r6 = new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE );
    NativeSQLQueryCollectionReturn r7 = new NativeSQLQueryCollectionReturn( "b", "c", "a", null, LockMode.NONE );

    check( false, r1, r2 );
    check( false, r1, r3NullMap );
    check( false, r1, r3EmptyMap );
    check( false, r1, r4 );
    check( false, r1, r5 );
    check( false, r1, r6 );
    check( false, r1, r7 );

    check( false, r2, r3NullMap );
    check( false, r2, r3EmptyMap );
    check( false, r2, r4 );
    check( false, r2, r5 );
    check( false, r2, r6 );
    check( false, r2, r7 );

    check( true, r3NullMap, r3EmptyMap );
    check( false, r3NullMap, r4 );
    check( false, r3NullMap, r5 );
    check( false, r3NullMap, r6 );
    check( false, r3NullMap, r7 );

    check( false, r3EmptyMap, r4 );
    check( false, r3EmptyMap, r5 );
    check( false, r3EmptyMap, r6 );
    check( false, r3EmptyMap, r7 );

    check( false, r4, r5 );
    check( false, r4, r6 );
    check( false, r4, r7 );

    check( false, r5, r6 );
    check( false, r5, r7 );

    check( false, r6, r7 );

    check( true, r1, new NativeSQLQueryCollectionReturn( "a", "b", "c", null, null) );
    check( true, r2, new NativeSQLQueryCollectionReturn( "a", "c", "b", null, null) );
    check( true, r3NullMap, new NativeSQLQueryCollectionReturn( "b", "c", "a", null, null) );
    check( true, r3EmptyMap, new NativeSQLQueryCollectionReturn( "b", "c", "a", new HashMap(), null) );
    check( true, r4, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), null) );
    check( true, r5, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "otherkey", "othervalue" ), null) );
    check( true, r6, new NativeSQLQueryCollectionReturn( "b", "c", "a", Collections.singletonMap( "key", "value" ), LockMode.NONE ) );
    check( true, r7, new NativeSQLQueryCollectionReturn( "b", "c", "a", null, LockMode.NONE ) );
  }
View Full Code Here

  public void testNativeSQLQueryReturnTypes() {
    NativeSQLQueryScalarReturn r1 = new NativeSQLQueryScalarReturn( "a", TypeFactory.basic( "int" ) );
    NativeSQLQueryRootReturn r2 = new NativeSQLQueryRootReturn( "a", "b", LockMode.NONE );
    NativeSQLQueryJoinReturn r3 = new NativeSQLQueryJoinReturn( "a", "b", "c", Collections.singletonMap( "key", "value" ), LockMode.NONE );
    NativeSQLQueryCollectionReturn r4 = new NativeSQLQueryCollectionReturn( "a", "b", "c", Collections.singletonMap( "key", "value" ), LockMode.NONE);

    check( false, r1, r2 );
    check( false, r1, r3 );
    check( false, r1, r4 );
View Full Code Here

TOP

Related Classes of org.hibernate.engine.query.sql.NativeSQLQueryCollectionReturn

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.