Java 类org.hibernate.util.ArrayHelper 实例源码

项目:cacheonix-core    文件:BatchingEntityLoader.java   
public static UniqueEntityLoader createBatchingEntityLoader(
    final OuterJoinLoadable persister,
    final int maxBatchSize,
    final LockMode lockMode,
    final SessionFactoryImplementor factory,
    final Map enabledFilters)
throws MappingException {

    if ( maxBatchSize>1 ) {
        int[] batchSizesToCreate = ArrayHelper.getBatchSizes(maxBatchSize);
        Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
        for ( int i=0; i<batchSizesToCreate.length; i++ ) {
            loadersToCreate[i] = new EntityLoader(persister, batchSizesToCreate[i], lockMode, factory, enabledFilters);
        }
        return new BatchingEntityLoader(persister, batchSizesToCreate, loadersToCreate);
    }
    else {
        return new EntityLoader(persister, lockMode, factory, enabledFilters);
    }
}
项目:cacheonix-core    文件:CustomLoader.java   
protected void autoDiscoverTypes(ResultSet rs) {
    try {
        Metadata metadata = new Metadata( getFactory(), rs );
        List aliases = new ArrayList();
        List types = new ArrayList();

        rowProcessor.prepareForAutoDiscovery( metadata );

        for ( int i = 0; i < rowProcessor.columnProcessors.length; i++ ) {
            rowProcessor.columnProcessors[i].performDiscovery( metadata, types, aliases );
        }

        resultTypes = ArrayHelper.toTypeArray( types );
        transformerAliases = ArrayHelper.toStringArray( aliases );
    }
    catch ( SQLException e ) {
        throw new HibernateException( "Exception while trying to autodiscover types.", e );
    }
}
项目:cacheonix-core    文件:BatchingCollectionInitializer.java   
public static CollectionInitializer createBatchingOneToManyInitializer(
    final QueryableCollection persister,
    final int maxBatchSize,
    final SessionFactoryImplementor factory,
    final Map enabledFilters)
throws MappingException {

    if ( maxBatchSize>1 ) {
        int[] batchSizesToCreate = ArrayHelper.getBatchSizes(maxBatchSize);
        Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
        for ( int i=0; i<batchSizesToCreate.length; i++ ) {
            loadersToCreate[i] = new OneToManyLoader(persister, batchSizesToCreate[i], factory, enabledFilters);
        }
        return new BatchingCollectionInitializer(persister, batchSizesToCreate, loadersToCreate);
    }
    else {
        return new OneToManyLoader(persister, factory, enabledFilters);
    }
}
项目:cacheonix-core    文件:BatchingCollectionInitializer.java   
public static CollectionInitializer createBatchingCollectionInitializer(
    final QueryableCollection persister,
    final int maxBatchSize,
    final SessionFactoryImplementor factory,
    final Map enabledFilters)
throws MappingException {

    if ( maxBatchSize>1 ) {
        int[] batchSizesToCreate = ArrayHelper.getBatchSizes(maxBatchSize);
        Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
        for ( int i=0; i<batchSizesToCreate.length; i++ ) {
            loadersToCreate[i] = new BasicCollectionLoader(persister, batchSizesToCreate[i], factory, enabledFilters);
        }
        return new BatchingCollectionInitializer(persister, batchSizesToCreate, loadersToCreate);
    }
    else {
        return new BasicCollectionLoader(persister, factory, enabledFilters);
    }
}
项目:cacheonix-core    文件:AbstractEntityPersister.java   
/**
 * Warning:
 * When there are duplicated property names in the subclasses
 * of the class, this method may return the wrong table
 * number for the duplicated subclass property (note that
 * SingleTableEntityPersister defines an overloaded form
 * which takes the entity name.
 */
public int getSubclassPropertyTableNumber(String propertyPath) {
    String rootPropertyName = StringHelper.root(propertyPath);
    Type type = propertyMapping.toType(rootPropertyName);
    if ( type.isAssociationType() ) {
        AssociationType assocType = ( AssociationType ) type;
        if ( assocType.useLHSPrimaryKey() ) {
            // performance op to avoid the array search
            return 0;
        }
        else if ( type.isCollectionType() ) {
            // properly handle property-ref-based associations
            rootPropertyName = assocType.getLHSPropertyName();
        }
    }
    //Enable for HHH-440, which we don't like:
    /*if ( type.isComponentType() && !propertyName.equals(rootPropertyName) ) {
        String unrooted = StringHelper.unroot(propertyName);
        int idx = ArrayHelper.indexOf( getSubclassColumnClosure(), unrooted );
        if ( idx != -1 ) {
            return getSubclassColumnTableNumberClosure()[idx];
        }
    }*/
    int index = ArrayHelper.indexOf( getSubclassPropertyNameClosure(), rootPropertyName); //TODO: optimize this better!
    return index==-1 ? 0 : getSubclassPropertyTableNumber(index);
}
项目:cacheonix-core    文件:BasicCollectionPersister.java   
/**
 * Generate the SQL UPDATE that updates a row
 */
protected String generateUpdateRowString() {

    Update update = new Update( getDialect() )
        .setTableName( qualifiedTableName );

    //if ( !elementIsFormula ) {
        update.addColumns( elementColumnNames, elementColumnIsSettable );
    //}

    if ( hasIdentifier ) {
        update.setPrimaryKeyColumnNames( new String[]{ identifierColumnName } );
    }
    else if ( hasIndex && !indexContainsFormula ) {
        update.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, indexColumnNames ) );
    }
    else {
        update.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey ) );
    }

    if ( getFactory().getSettings().isCommentsEnabled() ) {
        update.setComment( "update collection row " + getRole() );
    }

    return update.toStatementString();
}
项目:cacheonix-core    文件:BasicCollectionPersister.java   
/**
 * Generate the SQL DELETE that deletes a particular row
 */
protected String generateDeleteRowString() {

    Delete delete = new Delete()
        .setTableName( qualifiedTableName );

    if ( hasIdentifier ) {
        delete.setPrimaryKeyColumnNames( new String[]{ identifierColumnName } );
    }
    else if ( hasIndex && !indexContainsFormula ) {
        delete.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, indexColumnNames ) );
    }
    else {
        delete.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey ) );
    }

    if ( getFactory().getSettings().isCommentsEnabled() ) {
        delete.setComment( "delete collection row " + getRole() );
    }

    return delete.toStatementString();
}
项目:cacheonix-core    文件:OneToManyPersister.java   
/**
 * Generate the SQL UPDATE that updates a particular row's foreign
 * key to null
 */
protected String generateDeleteRowString() {

    Update update = new Update( getDialect() )
            .setTableName( qualifiedTableName )
            .addColumns( keyColumnNames, "null" );

    if ( hasIndex && !indexContainsFormula ) update.addColumns( indexColumnNames, "null" );

    if ( getFactory().getSettings().isCommentsEnabled() ) {
        update.setComment( "delete one-to-many row " + getRole() );
    }

    //use a combination of foreign key columns and pk columns, since
    //the ordering of removal and addition is not guaranteed when
    //a child moves from one parent to another
    String[] rowSelectColumnNames = ArrayHelper.join(keyColumnNames, elementColumnNames);
    return update.setPrimaryKeyColumnNames( rowSelectColumnNames )
            .toStatementString();
}
项目:cacheonix-core    文件:SchemaExportTask.java   
private String[] getFiles() {

        List files = new LinkedList();
        for ( Iterator i = fileSets.iterator(); i.hasNext(); ) {

            FileSet fs = (FileSet) i.next();
            DirectoryScanner ds = fs.getDirectoryScanner( getProject() );

            String[] dsFiles = ds.getIncludedFiles();
            for (int j = 0; j < dsFiles.length; j++) {
                File f = new File(dsFiles[j]);
                if ( !f.isFile() ) {
                    f = new File( ds.getBasedir(), dsFiles[j] );
                }

                files.add( f.getAbsolutePath() );
            }
        }

        return ArrayHelper.toStringArray(files);
    }
项目:cacheonix-core    文件:SchemaUpdateTask.java   
private String[] getFiles() {

        List files = new LinkedList();
        for ( Iterator i = fileSets.iterator(); i.hasNext(); ) {

            FileSet fs = (FileSet) i.next();
            DirectoryScanner ds = fs.getDirectoryScanner( getProject() );

            String[] dsFiles = ds.getIncludedFiles();
            for (int j = 0; j < dsFiles.length; j++) {
                File f = new File(dsFiles[j]);
                if ( !f.isFile() ) {
                    f = new File( ds.getBasedir(), dsFiles[j] );
                }

                files.add( f.getAbsolutePath() );
            }
        }

        return ArrayHelper.toStringArray(files);
    }
项目:cacheonix-core    文件:SchemaValidatorTask.java   
private String[] getFiles() {

        List files = new LinkedList();
        for ( Iterator i = fileSets.iterator(); i.hasNext(); ) {

            FileSet fs = (FileSet) i.next();
            DirectoryScanner ds = fs.getDirectoryScanner( getProject() );

            String[] dsFiles = ds.getIncludedFiles();
            for (int j = 0; j < dsFiles.length; j++) {
                File f = new File(dsFiles[j]);
                if ( !f.isFile() ) {
                    f = new File( ds.getBasedir(), dsFiles[j] );
                }

                files.add( f.getAbsolutePath() );
            }
        }

        return ArrayHelper.toStringArray(files);
    }
项目:cacheonix-core    文件:NativeSQLQuerySpecification.java   
public NativeSQLQuerySpecification(
        String queryString,
        NativeSQLQueryReturn[] queryReturns,
        Collection querySpaces) {
    this.queryString = queryString;
    this.queryReturns = queryReturns;
    if ( querySpaces == null ) {
        this.querySpaces = Collections.EMPTY_SET;
    }
    else {
        Set tmp = new HashSet();
        tmp.addAll( querySpaces );
        this.querySpaces = Collections.unmodifiableSet( tmp );
    }

    // pre-determine and cache the hashcode
    int hashCode = queryString.hashCode();
    hashCode = 29 * hashCode + this.querySpaces.hashCode();
    if ( this.queryReturns != null ) {
        hashCode = 29 * hashCode + ArrayHelper.toList( this.queryReturns ).hashCode();
    }
    this.hashCode = hashCode;
}
项目:cacheonix-core    文件:JoinHelper.java   
/**
 * Get the aliased columns of the owning entity which are to 
 * be used in the join
 */
public static String[] getAliasedLHSColumnNames(
        AssociationType type, 
        String alias, 
        int property, 
        int begin, 
        OuterJoinLoadable lhsPersister,
        Mapping mapping
) {
    if ( type.useLHSPrimaryKey() ) {
        return StringHelper.qualify( alias, lhsPersister.getIdentifierColumnNames() );
    }
    else {
        String propertyName = type.getLHSPropertyName();
        if (propertyName==null) {
            return ArrayHelper.slice( 
                    lhsPersister.toColumns(alias, property), 
                    begin, 
                    type.getColumnSpan(mapping) 
                );
        }
        else {
            return ( (PropertyMapping) lhsPersister ).toColumns(alias, propertyName); //bad cast
        }
    }
}
项目:cacheonix-core    文件:Property.java   
public boolean isUpdateable() {
    // if the property mapping consists of all formulas, 
    // make it non-updateable
    final boolean[] columnUpdateability = value.getColumnUpdateability();
    return updateable && ( 
            //columnUpdateability.length==0 ||
            !ArrayHelper.isAllFalse(columnUpdateability)
        );
}
项目:cacheonix-core    文件:Property.java   
public boolean isInsertable() {
    // if the property mapping consists of all formulas, 
    // make it insertable
    final boolean[] columnInsertability = value.getColumnInsertability();
    return insertable && (
            columnInsertability.length==0 ||
            !ArrayHelper.isAllFalse(columnInsertability)
        );
}
项目:cacheonix-core    文件:ProjectionList.java   
public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
    List types = new ArrayList( getLength() );
    for ( int i=0; i<getLength(); i++ ) {
        Type[] elemTypes = getProjection(i).getTypes(criteria, criteriaQuery);
        ArrayHelper.addAll(types, elemTypes);
    }
    return ArrayHelper.toTypeArray(types);
}
项目:cacheonix-core    文件:ProjectionList.java   
public String[] getColumnAliases(int loc) {
    List result = new ArrayList( getLength() );
    for ( int i=0; i<getLength(); i++ ) {
        String[] colAliases = getProjection(i).getColumnAliases(loc);
        ArrayHelper.addAll(result, colAliases);
        loc+=colAliases.length;
    }
    return ArrayHelper.toStringArray(result);
}
项目:cacheonix-core    文件:ProjectionList.java   
public String[] getAliases() {
    List result = new ArrayList( getLength() );
    for ( int i=0; i<getLength(); i++ ) {
        String[] aliases = getProjection(i).getAliases();
        ArrayHelper.addAll(result, aliases);
    }
    return ArrayHelper.toStringArray(result);

}
项目:cacheonix-core    文件:CollectionElementLoader.java   
public CollectionElementLoader(
        QueryableCollection collectionPersister,
        SessionFactoryImplementor factory, 
        Map enabledFilters) 
throws MappingException {
    super(factory, enabledFilters);

    this.keyType = collectionPersister.getKeyType();
    this.indexType = collectionPersister.getIndexType();
    this.persister = (OuterJoinLoadable) collectionPersister.getElementPersister();
    this.entityName = persister.getEntityName();

    JoinWalker walker = new EntityJoinWalker(
            persister, 
            ArrayHelper.join( 
                    collectionPersister.getKeyColumnNames(), 
                    collectionPersister.getIndexColumnNames()
                ),
            1, 
            LockMode.NONE, 
            factory, 
            enabledFilters
        );
    initFromWalker( walker );

    postInstantiate();

    log.debug( "Static select for entity " + entityName + ": " + getSQLString() );

}
项目:cacheonix-core    文件:CriteriaJoinWalker.java   
public CriteriaJoinWalker(
        final OuterJoinLoadable persister, 
        final CriteriaQueryTranslator translator,
        final SessionFactoryImplementor factory, 
        final CriteriaImpl criteria, 
        final String rootEntityName,
        final Map enabledFilters)
throws HibernateException {
    super(persister, factory, enabledFilters);

    this.translator = translator;

    querySpaces = translator.getQuerySpaces();

    if ( translator.hasProjection() ) {
        resultTypes = translator.getProjectedTypes();

        initProjection( 
                translator.getSelect(), 
                translator.getWhereCondition(), 
                translator.getOrderBy(),
                translator.getGroupBy(),
                LockMode.NONE 
            );
    }
    else {
        resultTypes = new Type[] { TypeFactory.manyToOne( persister.getEntityName() ) };

        initAll( translator.getWhereCondition(), translator.getOrderBy(), LockMode.NONE );
    }

    userAliasList.add( criteria.getAlias() ); //root entity comes *last*
    userAliases = ArrayHelper.toStringArray(userAliasList);

}
项目:cacheonix-core    文件:CustomLoader.java   
public int[] getNamedParameterLocs(String name) throws QueryException {
    Object loc = namedParameterBindPoints.get( name );
    if ( loc == null ) {
        throw new QueryException(
                "Named parameter does not appear in Query: " + name,
                sql
        );
    }
    if ( loc instanceof Integer ) {
        return new int[] { ( ( Integer ) loc ).intValue() };
    }
    else {
        return ArrayHelper.toIntArray( ( List ) loc );
    }
}
项目:cacheonix-core    文件:AbstractEntityPersister.java   
/**
 * Marshall the fields of a persistent instance to a prepared statement
 */
protected int dehydrate(
        final Serializable id,
        final Object[] fields,
        final Object rowId,
        final boolean[] includeProperty,
        final boolean[][] includeColumns,
        final int j,
        final PreparedStatement ps,
        final SessionImplementor session,
        int index) throws SQLException, HibernateException {

    if ( log.isTraceEnabled() ) {
        log.trace( "Dehydrating entity: " + MessageHelper.infoString( this, id, getFactory() ) );
    }

    for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
        if ( includeProperty[i] && isPropertyOfTable( i, j ) ) {
            getPropertyTypes()[i].nullSafeSet( ps, fields[i], index, includeColumns[i], session );
            //index += getPropertyColumnSpan( i );
            index += ArrayHelper.countTrue( includeColumns[i] ); //TODO:  this is kinda slow...
        }
    }

    if ( rowId != null ) {
        ps.setObject( index, rowId );
        index += 1;
    }
    else if ( id != null ) {
        getIdentifierType().nullSafeSet( ps, id, index, session );
        index += getIdentifierColumnSpan();
    }

    return index;

}
项目:cacheonix-core    文件:AbstractCollectionPersister.java   
/**
 * Write the element to a JDBC <tt>PreparedStatement</tt>
 */
protected int writeElement(PreparedStatement st, Object elt, int i, SessionImplementor session)
        throws HibernateException, SQLException {
    getElementType().nullSafeSet(st, elt, i, elementColumnIsSettable, session);
    return i + ArrayHelper.countTrue(elementColumnIsSettable);

}
项目:cacheonix-core    文件:NativeSQLQueryPlan.java   
private int[] getNamedParameterLocs(String name) throws QueryException {
    Object loc = customQuery.getNamedParameterBindPoints().get( name );
    if ( loc == null ) {
        throw new QueryException(
                "Named parameter does not appear in Query: " + name,
                customQuery.getSQL() );
    }
    if ( loc instanceof Integer ) {
        return new int[] { ((Integer) loc ).intValue() };
    }
    else {
        return ArrayHelper.toIntArray( (List) loc );
    }
}
项目:cacheonix-core    文件:JoinHelper.java   
/**
 * Get the columns of the owning entity which are to 
 * be used in the join
 */
public static String[] getLHSColumnNames(
        AssociationType type, 
        int property, 
        int begin, 
        OuterJoinLoadable lhsPersister,
        Mapping mapping
) {
    if ( type.useLHSPrimaryKey() ) {
        //return lhsPersister.getSubclassPropertyColumnNames(property);
        return lhsPersister.getIdentifierColumnNames();
    }
    else {
        String propertyName = type.getLHSPropertyName();
        if (propertyName==null) {
            //slice, to get the columns for this component
            //property
            return ArrayHelper.slice( 
                    lhsPersister.getSubclassPropertyColumnNames(property),
                    begin, 
                    type.getColumnSpan(mapping) 
                );
        }
        else {
            //property-refs for associations defined on a
            //component are not supported, so no need to slice
            return lhsPersister.getPropertyColumnNames(propertyName);
        }
    }
}
项目:cacheonix-core    文件:ExceptionUtils.java   
/**
 * <p>Creates a compact stack trace for the root cause of the supplied
 * <code>Throwable</code>.</p>
 *
 * @param throwable the throwable to examine, may be null
 * @return an array of stack trace frames, never null
 * @since 2.0
 */
public static String[] getRootCauseStackTrace(Throwable throwable) {
    if ( throwable == null ) {
        return ArrayHelper.EMPTY_STRING_ARRAY;
    }
    Throwable throwables[] = getThrowables( throwable );
    int count = throwables.length;
    ArrayList frames = new ArrayList();
    List nextTrace = getStackFrameList( throwables[count - 1] );
    for ( int i = count; --i >= 0; ) {
        List trace = nextTrace;
        if ( i != 0 ) {
            nextTrace = getStackFrameList( throwables[i - 1] );
            removeCommonFrames( trace, nextTrace );
        }
        if ( i == count - 1 ) {
            frames.add( throwables[i].toString() );
        }
        else {
            frames.add( WRAPPED_MARKER + throwables[i].toString() );
        }
        for ( int j = 0; j < trace.size(); j++ ) {
            frames.add( trace.get( j ) );
        }
    }
    return ( String[] ) frames.toArray( new String[0] );
}
项目:cacheonix-core    文件:StatisticsImpl.java   
/**
 * Get the names of all entities
 */
public String[] getEntityNames() {
    if (sessionFactory==null) {
        return ArrayHelper.toStringArray( entityStatistics.keySet() );
    }
    else {
        return ArrayHelper.toStringArray( sessionFactory.getAllClassMetadata().keySet() );
    }
}
项目:cacheonix-core    文件:StatisticsImpl.java   
/**
 * Get the names of all collection roles
 */
public String[] getCollectionRoleNames() {
    if (sessionFactory==null) {
        return ArrayHelper.toStringArray( collectionStatistics.keySet() );
    }
    else {
        return ArrayHelper.toStringArray( sessionFactory.getAllCollectionMetadata().keySet() );
    }
}
项目:cacheonix-core    文件:StatisticsImpl.java   
/**
 * Get all second-level cache region names
 */
public String[] getSecondLevelCacheRegionNames() {
    if (sessionFactory==null) {
        return ArrayHelper.toStringArray( secondLevelCacheStatistics.keySet() );
    }
    else {
        return ArrayHelper.toStringArray( sessionFactory.getAllSecondLevelCacheRegions().keySet() );
    }
}
项目:cacheonix-core    文件:IntoClause.java   
private void initializeColumns() {
    AST propertySpec = getFirstChild();
    List types = new ArrayList();
    visitPropertySpecNodes( propertySpec.getFirstChild(), types );
    this.types = ArrayHelper.toTypeArray( types );
    columnSpec = columnSpec.substring( 0, columnSpec.length() - 2 );
}
项目:cacheonix-core    文件:HqlSqlWalker.java   
/**
 * Returns the locations of all occurrences of the named parameter.
 */
public int[] getNamedParameterLocations(String name) throws QueryException {
    Object o = namedParameters.get( name );
    if ( o == null ) {
        QueryException qe = new QueryException( QueryTranslator.ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR + name );
        qe.setQueryString( queryTranslatorImpl.getQueryString() );
        throw qe;
    }
    if ( o instanceof Integer ) {
        return new int[]{( ( Integer ) o ).intValue()};
    }
    else {
        return ArrayHelper.toIntArray( ( ArrayList ) o );
    }
}
项目:cacheonix-core    文件:QueryTranslatorImpl.java   
public int[] getNamedParameterLocs(String name) throws QueryException {
    Object o = namedParameters.get( name );
    if ( o == null ) {
        QueryException qe = new QueryException( ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR + name );
        qe.setQueryString( queryString );
        throw qe;
    }
    if ( o instanceof Integer ) {
        return new int[]{ ( ( Integer ) o ).intValue() };
    }
    else {
        return ArrayHelper.toIntArray( ( ArrayList ) o );
    }
}
项目:cacheonix-core    文件:ComponentType.java   
public void nullSafeSet(
        PreparedStatement st,
        Object value,
        int begin,
        boolean[] settable,
        SessionImplementor session)
        throws HibernateException, SQLException {

    Object[] subvalues = nullSafeGetValues( value, session.getEntityMode() );

    int loc = 0;
    for ( int i = 0; i < propertySpan; i++ ) {
        int len = propertyTypes[i].getColumnSpan( session.getFactory() );
        if ( len == 0 ) {
            //noop
        }
        else if ( len == 1 ) {
            if ( settable[loc] ) {
                propertyTypes[i].nullSafeSet( st, subvalues[i], begin, session );
                begin++;
            }
        }
        else {
            boolean[] subsettable = new boolean[len];
            System.arraycopy( settable, loc, subsettable, 0, len );
            propertyTypes[i].nullSafeSet( st, subvalues[i], begin, subsettable, session );
            begin += ArrayHelper.countTrue( subsettable );
        }
        loc += len;
    }
}
项目:cacheonix-core    文件:ComponentType.java   
public Object hydrate(
        final ResultSet rs,
        final String[] names,
        final SessionImplementor session,
        final Object owner)
        throws HibernateException, SQLException {

    int begin = 0;
    boolean notNull = false;
    Object[] values = new Object[propertySpan];
    for ( int i = 0; i < propertySpan; i++ ) {
        int length = propertyTypes[i].getColumnSpan( session.getFactory() );
        String[] range = ArrayHelper.slice( names, begin, length ); //cache this
        Object val = propertyTypes[i].hydrate( rs, range, session, owner );
        if ( val == null ) {
            if ( isKey ) {
                return null; //different nullability rules for pk/fk
            }
        }
        else {
            notNull = true;
        }
        values[i] = val;
        begin += length;
    }

    return notNull ? values : null;
}
项目:webdsl    文件:BatchingEntityLoader.java   
public static BatchingEntityLoader createBatchingEntityLoader(
            final OuterJoinLoadable persister,
            final SessionFactoryImplementor factory) throws MappingException {
            int[] batchSizesToCreate = ArrayHelper.getBatchSizes(DEFAULT_MAX_BATCH_SIZE);
      //System.out.print("created loader");
            Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
            for ( int i=0; i<batchSizesToCreate.length; i++ ) {
                loadersToCreate[i] = new EntityLoader(persister, batchSizesToCreate[i], LockMode.NONE, factory, LoadQueryInfluencers.NONE);
//        System.out.print(", " + batchSizesToCreate[i]);
            }
//      org.webdsl.logging.Logger.info();
            return new BatchingEntityLoader(persister, batchSizesToCreate, loadersToCreate);
    }
项目:webdsl    文件:BatchingCollectionInitializer.java   
public static BatchingCollectionInitializer createBatchingOneToManyInitializer(
        final QueryableCollection persister,
        final int maxBatchSize,
        final SessionFactoryImplementor factory,
        final LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
    int[] batchSizesToCreate = ArrayHelper.getBatchSizes(maxBatchSize > DEFAULT_MAX_BATCH_SIZE ? maxBatchSize : DEFAULT_MAX_BATCH_SIZE);
    Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
    for ( int i=0; i<batchSizesToCreate.length; i++ ) {
        loadersToCreate[i] = new OneToManyLoader( persister, batchSizesToCreate[i], factory, loadQueryInfluencers );
    }
    return new BatchingCollectionInitializer( persister, batchSizesToCreate, loadersToCreate, maxBatchSize );
}
项目:webdsl    文件:BatchingCollectionInitializer.java   
public static BatchingCollectionInitializer createBatchingCollectionInitializer(
        final QueryableCollection persister,
        final int maxBatchSize,
        final SessionFactoryImplementor factory,
        final LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
    int[] batchSizesToCreate = ArrayHelper.getBatchSizes(maxBatchSize > DEFAULT_MAX_BATCH_SIZE ? maxBatchSize : DEFAULT_MAX_BATCH_SIZE);
    Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
    for ( int i=0; i<batchSizesToCreate.length; i++ ) {
        loadersToCreate[i] = new BasicCollectionLoader( persister, batchSizesToCreate[i], factory, loadQueryInfluencers );
    }
    return new BatchingCollectionInitializer(persister, batchSizesToCreate, loadersToCreate, maxBatchSize);
}
项目:cacheonix-core    文件:Collection.java   
public boolean[] getColumnInsertability() {
    return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
}
项目:cacheonix-core    文件:Collection.java   
public boolean[] getColumnUpdateability() {
    return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
}
项目:cacheonix-core    文件:JoinWalker.java   
protected void initPersisters(final List associations, final LockMode lockMode) throws MappingException {

    final int joins = countEntityPersisters(associations);
    final int collections = countCollectionPersisters(associations);

    collectionOwners = collections==0 ? null : new int[collections];
    collectionPersisters = collections==0 ? null : new CollectionPersister[collections];
    collectionSuffixes = BasicLoader.generateSuffixes( joins + 1, collections );

    persisters = new Loadable[joins];
    aliases = new String[joins];
    owners = new int[joins];
    ownerAssociationTypes = new EntityType[joins];
    lockModeArray = ArrayHelper.fillArray(lockMode, joins);

    int i=0;
    int j=0;
    Iterator iter = associations.iterator();
    while ( iter.hasNext() ) {
        final OuterJoinableAssociation oj = (OuterJoinableAssociation) iter.next();
        if ( !oj.isCollection() ) {

            persisters[i] = (Loadable) oj.getJoinable();
            aliases[i] = oj.getRHSAlias();
            owners[i] = oj.getOwner(associations);
            ownerAssociationTypes[i] = (EntityType) oj.getJoinableType();
            i++;

        }
        else {

            QueryableCollection collPersister = (QueryableCollection) oj.getJoinable();
            if ( oj.getJoinType()==JoinFragment.LEFT_OUTER_JOIN ) {
                //it must be a collection fetch
                collectionPersisters[j] = collPersister;
                collectionOwners[j] = oj.getOwner(associations);
                j++;
            }

            if ( collPersister.isOneToMany() ) {
                persisters[i] = (Loadable) collPersister.getElementPersister();
                aliases[i] = oj.getRHSAlias();
                i++;
            }
        }
    }

    if ( ArrayHelper.isAllNegative(owners) ) owners = null;
    if ( collectionOwners!=null && ArrayHelper.isAllNegative(collectionOwners) ) {
        collectionOwners = null;
    }
}