Java 类org.hibernate.persister.collection.SQLLoadableCollection 实例源码

项目:lams    文件:ColumnCollectionAliases.java   
public ColumnCollectionAliases(Map userProvidedAliases, SQLLoadableCollection persister) {
    this.userProvidedAliases = userProvidedAliases;

    this.keyAliases = getUserProvidedAliases(
            "key",
            persister.getKeyColumnNames()
        );

    this.indexAliases = getUserProvidedAliases(
            "index",
            persister.getIndexColumnNames()
            );

    this.elementAliases = getUserProvidedAliases( "element",
            persister.getElementColumnNames()
            );

    this.identifierAlias = getUserProvidedAlias( "id",
            persister.getIdentifierColumnName()
            );

}
项目:cacheonix-core    文件:ColumnCollectionAliases.java   
public ColumnCollectionAliases(Map userProvidedAliases, SQLLoadableCollection persister) {
    this.userProvidedAliases = userProvidedAliases;

    this.keyAliases = getUserProvidedAliases(
            "key", 
            persister.getKeyColumnNames()
        );

    this.indexAliases = getUserProvidedAliases(
            "index",
            persister.getIndexColumnNames()
            );

    this.elementAliases = getUserProvidedAliases( "element", 
            persister.getElementColumnNames()
            );

    this.identifierAlias = getUserProvidedAlias( "id", 
            persister.getIdentifierColumnName()
            );

}
项目:lams    文件:SQLQueryReturnProcessor.java   
private void addCollection(String role, String alias, Map propertyResults) {
    SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getCollectionPersister( role );
    alias2CollectionPersister.put( alias, collectionPersister );
    String suffix = generateCollectionSuffix();
    LOG.tracev( "Mapping alias [{0}] to collection-suffix [{1}]", alias, suffix );
    alias2CollectionSuffix.put( alias, suffix );
    collectionPropertyResultMaps.put( alias, propertyResults );

    if ( collectionPersister.isOneToMany() || collectionPersister.isManyToMany() ) {
        SQLLoadable persister = ( SQLLoadable ) collectionPersister.getElementPersister();
        addPersister( alias, filter( propertyResults ), persister );
    }
}
项目:cacheonix-core    文件:SQLQueryReturnProcessor.java   
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 );
    }
}
项目:lams    文件:SQLCustomQuery.java   
public SQLLoadableCollection getCollectionPersisterByAlias(String alias) {
    return aliasContext.getCollectionPersister( alias );
}
项目:lams    文件:SQLQueryReturnProcessor.java   
public SQLLoadableCollection getCollectionPersister(String alias) {
    return (SQLLoadableCollection) alias2CollectionPersister.get( alias );
}
项目:lams    文件:SQLQueryParser.java   
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 + "]",
                    originalQueryString
            );
        }
        if ( columnAliases.length != 1 ) {
            // TODO: better error message since we actually support composites if names are explicitly listed.
            throw new QueryException(
                    "SQL queries only support properties mapped to a single column - property [" +
                    propertyName + "] is mapped to " + columnAliases.length + " columns.",
                    originalQueryString
            );
        }
        aliasesFound++;
        return columnAliases[0];

    }
}
项目:hibernate-ogm-ignite    文件:IgniteSqlQueryParser.java   
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 + "]",
                    originalQuery );
        }
        if ( columnAliases.length != 1 ) {
            // TODO: better error message since we actually support composites if names are explicitly listed.
            throw new QueryException(
                    "SQL queries only support properties mapped to a single column - property [" +
                            propertyName + "] is mapped to " + columnAliases.length + " columns.",
                    originalQuery );
        }
        aliasesFound++;
        return columnAliases[0];

    }
}
项目:hibernate-ogm-ignite    文件:IgniteSqlQueryParser.java   
@Override
public SQLLoadableCollection getCollectionPersisterByAlias(String alias) {
    return null;
}
项目:cacheonix-core    文件:SQLCustomQuery.java   
public SQLLoadableCollection getCollectionPersisterByAlias(String alias) {
    return aliasContext.getCollectionPersister( alias );
}
项目:cacheonix-core    文件:SQLQueryReturnProcessor.java   
public SQLLoadableCollection getCollectionPersister(String alias) {
    return ( SQLLoadableCollection ) alias2CollectionPersister.get( alias );
}
项目:cacheonix-core    文件:SQLQueryParser.java   
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 + "]",
                    originalQueryString
            );
        }
        if ( columnAliases.length != 1 ) {
            // TODO: better error message since we actually support composites if names are explicitly listed.
            throw new QueryException(
                    "SQL queries only support properties mapped to a single column - property [" +
                    propertyName + "] is mapped to " + columnAliases.length + " columns.",
                    originalQueryString
            );
        }
        aliasesFound++;
        return columnAliases[0];

    }
}
项目:lams    文件:SQLQueryParser.java   
SQLLoadableCollection getCollectionPersisterByAlias(String alias);
项目:hibernate-ogm-ignite    文件:IgniteSqlQueryParser.java   
SQLLoadableCollection getCollectionPersisterByAlias(String alias);
项目:cacheonix-core    文件:SQLQueryParser.java   
SQLLoadableCollection getCollectionPersisterByAlias(String alias);