Java 类org.hibernate.sql.SelectValues 实例源码

项目:lams    文件:AbstractTableBasedBulkIdHandler.java   
protected String generateIdInsertSelect(Queryable persister, String tableAlias, ProcessedWhereClause whereClause) {
    Select select = new Select( sessionFactory.getDialect() );
    SelectValues selectClause = new SelectValues( sessionFactory.getDialect() )
            .addColumns( tableAlias, persister.getIdentifierColumnNames(), persister.getIdentifierColumnNames() );
    addAnyExtraIdSelectValues( selectClause );
    select.setSelectClause( selectClause.render() );

    String rootTableName = persister.getTableName();
    String fromJoinFragment = persister.fromJoinFragment( tableAlias, true, false );
    String whereJoinFragment = persister.whereJoinFragment( tableAlias, true, false );

    select.setFromClause( rootTableName + ' ' + tableAlias + fromJoinFragment );

    if ( whereJoinFragment == null ) {
        whereJoinFragment = "";
    }
    else {
        whereJoinFragment = whereJoinFragment.trim();
        if ( whereJoinFragment.startsWith( "and" ) ) {
            whereJoinFragment = whereJoinFragment.substring( 4 );
        }
    }

    if ( whereClause.getUserWhereClauseFragment().length() > 0 ) {
        if ( whereJoinFragment.length() > 0 ) {
            whereJoinFragment += " and ";
        }
    }
    select.setWhereClause( whereJoinFragment + whereClause.getUserWhereClauseFragment() );

    InsertSelect insert = new InsertSelect( sessionFactory.getDialect() );
    if ( sessionFactory.getSettings().isCommentsEnabled() ) {
        insert.setComment( "insert-select for " + persister.getEntityName() + " ids" );
    }
    insert.setTableName( determineIdTableName( persister ) );
    insert.setSelect( select );
    return insert.toStatementString();
}
项目:cte-multi-table-bulk-id-stategy    文件:AbstractCTEBasedBulkIdHandler.java   
protected String generateIdSelect(Queryable persister, String tableAlias,
                                  ProcessedWhereClause whereClause) {
    Select select = new Select( sessionFactory.getDialect());
    SelectValues selectClause = new SelectValues(
            sessionFactory.getDialect()).addColumns(tableAlias,
            persister.getIdentifierColumnNames(),
            persister.getIdentifierColumnNames());
    addAnyExtraIdSelectValues(selectClause);
    select.setSelectClause(selectClause.render());
    String rootTableName = persister.getTableName();
    String fromJoinFragment = persister.fromJoinFragment( tableAlias, true,
                                                          false);
    String whereJoinFragment = persister.whereJoinFragment( tableAlias,
                                                            true, false);
    select.setFromClause(rootTableName + ' ' + tableAlias
            + fromJoinFragment);
    if (whereJoinFragment == null) {
        whereJoinFragment = "";
    } else {
        whereJoinFragment = whereJoinFragment.trim();
        if (whereJoinFragment.startsWith("and")) {
            whereJoinFragment = whereJoinFragment.substring(4);
        }
    }
    if (whereClause.getUserWhereClauseFragment().length() > 0) {
        if (whereJoinFragment.length() > 0) {
            whereJoinFragment += " and ";
        }
    }
    select.setWhereClause(whereJoinFragment
            + whereClause.getUserWhereClauseFragment());
    return select.toStatementString();
}
项目:cte-multi-table-bulk-id-stategy    文件:AbstractCTEBasedBulkIdHandler.java   
protected String generateIdSelect(Queryable persister, String tableAlias,
        ProcessedWhereClause whereClause) {
    Select select = new Select(sessionFactory.getDialect());
    SelectValues selectClause = new SelectValues(
            sessionFactory.getDialect()).addColumns(tableAlias,
            persister.getIdentifierColumnNames(),
            persister.getIdentifierColumnNames());
    addAnyExtraIdSelectValues(selectClause);
    select.setSelectClause(selectClause.render());
    String rootTableName = persister.getTableName();
    String fromJoinFragment = persister.fromJoinFragment(tableAlias, true,
            false);
    String whereJoinFragment = persister.whereJoinFragment(tableAlias,
            true, false);
    select.setFromClause(rootTableName + ' ' + tableAlias
            + fromJoinFragment);
    if (whereJoinFragment == null) {
        whereJoinFragment = "";
    } else {
        whereJoinFragment = whereJoinFragment.trim();
        if (whereJoinFragment.startsWith("and")) {
            whereJoinFragment = whereJoinFragment.substring(4);
        }
    }
    if (whereClause.getUserWhereClauseFragment().length() > 0) {
        if (whereJoinFragment.length() > 0) {
            whereJoinFragment += " and ";
        }
    }
    select.setWhereClause(whereJoinFragment
            + whereClause.getUserWhereClauseFragment());
    return select.toStatementString();
}
项目:lams    文件:AbstractTableBasedBulkIdHandler.java   
protected void addAnyExtraIdSelectValues(SelectValues selectClause) {
}
项目:hibernate-single-table-bulk-id-strategy    文件:SingleGlobalTemporaryTableBulkIdStrategy.java   
protected void addExtraIdSelectValues(final Queryable targetedPersister, SelectValues selectClause) {
    selectClause.addColumn(null, '\'' + generateDiscriminatorValue(targetedPersister) + '\'', discriminatorColumn);
}
项目:cte-multi-table-bulk-id-stategy    文件:AbstractCTEBasedBulkIdHandler.java   
protected void addAnyExtraIdSelectValues(SelectValues selectClause) {
}
项目:cte-multi-table-bulk-id-stategy    文件:AbstractCTEBasedBulkIdHandler.java   
protected void addAnyExtraIdSelectValues(SelectValues selectClause) {
}