5454import org .hibernate .mapping .IdentifierCollection ;
5555import org .hibernate .mapping .IndexedCollection ;
5656import org .hibernate .mapping .Table ;
57- import org .hibernate .mapping .Value ;
5857import org .hibernate .metamodel .CollectionClassification ;
5958import org .hibernate .metamodel .mapping .AttributeMapping ;
6059import org .hibernate .metamodel .mapping .CollectionPart ;
@@ -247,6 +246,7 @@ public AbstractCollectionPersister(
247246 RuntimeModelCreationContext creationContext )
248247 throws MappingException , CacheException {
249248 factory = creationContext .getSessionFactory ();
249+ final var factoryOptions = creationContext .getSessionFactoryOptions ();
250250
251251 this .collectionBootDescriptor = collectionBootDescriptor ;
252252 this .collectionSemantics =
@@ -256,10 +256,10 @@ public AbstractCollectionPersister(
256256
257257
258258 this .cacheAccessStrategy = cacheAccessStrategy ;
259- cacheEntryStructure = cacheEntryStructure ( collectionBootDescriptor , creationContext );
259+ cacheEntryStructure =
260+ cacheEntryStructure ( collectionBootDescriptor , factoryOptions );
260261 useShallowQueryCacheLayout =
261- shouldUseShallowCacheLayout ( collectionBootDescriptor .getQueryCacheLayout (),
262- creationContext .getSessionFactoryOptions () );
262+ shouldUseShallowCacheLayout ( collectionBootDescriptor .getQueryCacheLayout (), factoryOptions );
263263
264264 dialect = creationContext .getDialect ();
265265 sqlExceptionHelper = creationContext .getJdbcServices ().getSqlExceptionHelper ();
@@ -292,7 +292,7 @@ public AbstractCollectionPersister(
292292
293293 hasOrphanDelete = collectionBootDescriptor .hasOrphanDelete ();
294294
295- batchSize = batchSize ( collectionBootDescriptor , creationContext );
295+ batchSize = batchSize ( collectionBootDescriptor , factoryOptions );
296296
297297 isVersioned = collectionBootDescriptor .isOptimisticLocked ();
298298
@@ -384,7 +384,7 @@ else if ( selectable instanceof Column column ) {
384384 if ( collectionBootDescriptor instanceof IndexedCollection indexedCollection ) {
385385 assert collectionBootDescriptor .isIndexed ();
386386 // NativeSQL: collect index column and auto-aliases
387- final Value index = indexedCollection .getIndex ();
387+ final var index = indexedCollection .getIndex ();
388388 indexType = index .getType ();
389389 final int indexSpan = index .getColumnSpan ();
390390 final boolean [] indexColumnInsertability = index .getColumnInsertability ();
@@ -511,7 +511,8 @@ private FilterHelper manyToManyFilterHelper(Collection collection, RuntimeModelC
511511
512512 private FilterHelper filterHelper (
513513 Collection collection , EntityPersister elementPersister , RuntimeModelCreationContext context ) {
514- if ( collection .getFilters ().isEmpty () ) {
514+ final var filters = collection .getFilters ();
515+ if ( filters .isEmpty () ) {
515516 return null ;
516517 }
517518 else {
@@ -522,18 +523,19 @@ private FilterHelper filterHelper(
522523 context .getBootModel ().getEntityBinding ( elementPersister .getEntityName () ),
523524 context .getSessionFactory ().getSqlStringGenerationContext ()
524525 );
525- return new FilterHelper ( collection . getFilters () , entityNameByTableNameMap , factory );
526+ return new FilterHelper ( filters , entityNameByTableNameMap , factory );
526527 }
527528 }
528529
529- private static int batchSize (Collection collection , RuntimeModelCreationContext context ) {
530- return collection .getBatchSize () < 0
531- ? context .getSessionFactoryOptions ().getDefaultBatchFetchSize ()
532- : collection .getBatchSize ();
530+ private static int batchSize (Collection collection , SessionFactoryOptions options ) {
531+ int batchSize = collection .getBatchSize ();
532+ return batchSize >= 0
533+ ? batchSize
534+ : options .getDefaultBatchFetchSize ();
533535 }
534536
535- private static CacheEntryStructure cacheEntryStructure (Collection collection , RuntimeModelCreationContext context ) {
536- if ( context . getSessionFactoryOptions () .isStructuredCacheEntriesEnabled () ) {
537+ private static CacheEntryStructure cacheEntryStructure (Collection collection , SessionFactoryOptions options ) {
538+ if ( options .isStructuredCacheEntriesEnabled () ) {
537539 return collection .isMap ()
538540 ? StructuredMapCacheEntry .INSTANCE
539541 : StructuredCollectionCacheEntry .INSTANCE ;
0 commit comments