@Override public Settings getSettings() { return delegate.getSettings(); }
public static BatchingCollectionInitializerBuilder getBuilder(SessionFactoryImplementor factory) { switch ( factory.getSettings().getBatchFetchStyle() ) { case PADDED: { return PaddedBatchingCollectionInitializerBuilder.INSTANCE; } case DYNAMIC: { return DynamicBatchingCollectionInitializerBuilder.INSTANCE; } default: { return org.hibernate.loader.collection.plan.LegacyBatchingCollectionInitializerBuilder.INSTANCE; //return LegacyBatchingCollectionInitializerBuilder.INSTANCE; } } }
public static BatchingEntityLoaderBuilder getBuilder(SessionFactoryImplementor factory) { switch ( factory.getSettings().getBatchFetchStyle() ) { case PADDED: { return PaddedBatchingEntityLoaderBuilder.INSTANCE; } case DYNAMIC: { return DynamicBatchingEntityLoaderBuilder.INSTANCE; } default: { return org.hibernate.loader.entity.plan.LegacyBatchingEntityLoaderBuilder.INSTANCE; // return LegacyBatchingEntityLoaderBuilder.INSTANCE; } } }
/** * Mainly for subclass usage. This impl always returns after_transaction. * * @return The connection release mode for any built sessions. */ protected ConnectionReleaseMode getConnectionReleaseMode() { return factory().getSettings().getConnectionReleaseMode(); }
/** * Advance the cursor to the first required row of the <tt>ResultSet</tt> */ protected void advance(final ResultSet rs, final RowSelection selection) throws SQLException { final int firstRow = LimitHelper.getFirstRow( selection ); if ( firstRow != 0 ) { if ( getFactory().getSettings().isScrollableResultSetsEnabled() ) { // we can go straight to the first required row rs.absolute( firstRow ); } else { // we need to step through the rows one row at a time (slow) for ( int m = 0; m < firstRow; m++ ) { rs.next(); } } } }
public Map<String, String> getAliasTableMap(SessionFactoryImplementor factory) { Map<String, String> mergedAliasTableMap = mergeAliasMaps( factory ); if ( !mergedAliasTableMap.isEmpty() ) { return mergedAliasTableMap; } else if ( persistentClass != null ) { String table = persistentClass.getTable().getQualifiedName( factory.getDialect(), factory.getSettings().getDefaultCatalogName(), factory.getSettings().getDefaultSchemaName() ); return Collections.singletonMap( null, table ); } else { return Collections.emptyMap(); } }
protected ScrollMode getScrollMode(boolean scroll, boolean hasFirstRow, boolean useLimitOffSet, QueryParameters queryParameters) { final boolean canScroll = getFactory().getSettings().isScrollableResultSetsEnabled(); if ( canScroll ) { if ( scroll ) { return queryParameters.getScrollMode(); } if ( hasFirstRow && !useLimitOffSet ) { return ScrollMode.SCROLL_INSENSITIVE; } } return null; }
@Override protected String renderOrderByElement(String expression, String order, String nulls) { final NullPrecedence nullPrecedence = NullPrecedence.parse( nulls, sessionFactory.getSettings() .getDefaultNullPrecedence() ); return sessionFactory.getDialect().renderOrderByElement( expression, null, order, nullPrecedence ); } }
private boolean isOuterJoinFetchingDisabled() { return new Integer(0).equals( sessionFactory().getSettings().getMaximumFetchDepth() ); }
@Test public void testBatchInsertUpdate() { long start = System.currentTimeMillis(); final int N = 5000; //26 secs with batch flush, 26 without //final int N = 100000; //53 secs with batch flush, OOME without //final int N = 250000; //137 secs with batch flush, OOME without int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdate( N, batchSize ); System.out.println( System.currentTimeMillis() - start ); }
@Test public void testBatchInsertUpdateSizeEqJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdate( 50, batchSize ); }
@Test public void testBatchInsertUpdateSizeLtJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdate( 50, batchSize - 1 ); }
@Test public void testBatchInsertUpdateSizeGtJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdate( 50, batchSize + 1 ); }
@Test public void testBatchInsertUpdateSizeGtJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdateJoined( 50, batchSize + 1 ); }
@Test public void testBatchInsertUpdateSizeEqJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdateJoined( 50, batchSize ); }
@Test public void testBatchInsertUpdateSizeEqJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdateJoined( 50, batchSize ); }
@Test public void testBatchInsertUpdateSizeGtJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdateJoined( 50, batchSize + 1 ); }
@Test public void testBatchInsertUpdateSizeLtJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdateJoined( 50, batchSize - 1 ); }
@Test public void testBatchInsertUpdateSizeLtJdbcBatchSize() { int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); doBatchInsertUpdateJoined( 50, batchSize - 1 ); }
protected FetchStrategy adjustJoinFetchIfNeeded( AssociationAttributeDefinition attributeDefinition, FetchStrategy fetchStrategy) { if ( lockMode.greaterThan( LockMode.READ ) ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } final Integer maxFetchDepth = sessionFactory().getSettings().getMaximumFetchDepth(); if ( maxFetchDepth != null && currentDepth() > maxFetchDepth ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } if ( attributeDefinition.getType().isCollectionType() && isTooManyCollections() ) { // todo : have this revert to batch or subselect fetching once "sql gen redesign" is in place return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } return fetchStrategy; }