We're updating the issue view to help you get more done. 

Using property "hibernate.default_batch_fetch_size" crashes bootstrapping

Description

See this forum post for context: https://discourse.hibernate.org/t/assertion-error-in-org-hibernate-engine-internal-batchfetchqueuehelper/477 .

Using attached test case, bootstrapping with "hibernate.default_batch_fetch_size" fails:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 org.hibernate.testing.junit4.CallbackException: org.hibernate.testing.junit4.BaseCoreFunctionalTestCase#buildSessionFactory at org.hibernate.testing.junit4.TestClassMetadata.performCallbackInvocation(TestClassMetadata.java:208) at org.hibernate.testing.junit4.TestClassMetadata.invokeCallback(TestClassMetadata.java:192) at org.hibernate.testing.junit4.TestClassMetadata.performCallbacks(TestClassMetadata.java:184) at org.hibernate.testing.junit4.TestClassMetadata.performBeforeClassCallbacks(TestClassMetadata.java:175) at org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:25) at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: java.lang.IllegalStateException: Attempt to register multiple SQL table aliases [usergroup3_, usergroup5_, etc] against query space uid [<gen:7>] at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.registerSqlTableAliasMapping(AliasResolutionContextImpl.java:247) at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.registerQuerySpaceAliases(AliasResolutionContextImpl.java:233) at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.generateEntityReferenceAliases(AliasResolutionContextImpl.java:126) at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.createCollectionElementAliases(AliasResolutionContextImpl.java:220) at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.generateCollectionReferenceAliases(AliasResolutionContextImpl.java:199) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.renderCollectionJoin(LoadQueryJoinAndFetchProcessor.java:354) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.renderJoin(LoadQueryJoinAndFetchProcessor.java:153) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoin(LoadQueryJoinAndFetchProcessor.java:128) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoins(LoadQueryJoinAndFetchProcessor.java:123) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoin(LoadQueryJoinAndFetchProcessor.java:129) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoins(LoadQueryJoinAndFetchProcessor.java:123) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoins(LoadQueryJoinAndFetchProcessor.java:104) at org.hibernate.loader.plan.exec.internal.AbstractLoadQueryDetails.generate(AbstractLoadQueryDetails.java:157) at org.hibernate.loader.plan.exec.internal.EntityLoadQueryDetails.<init>(EntityLoadQueryDetails.java:100) at org.hibernate.loader.plan.exec.internal.BatchingLoadQueryDetailsFactory.makeEntityLoadQueryDetails(BatchingLoadQueryDetailsFactory.java:82) at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.<init>(AbstractLoadPlanBasedEntityLoader.java:102) at org.hibernate.loader.entity.plan.EntityLoader.<init>(EntityLoader.java:153) at org.hibernate.loader.entity.plan.EntityLoader.<init>(EntityLoader.java:38) at org.hibernate.loader.entity.plan.EntityLoader$Builder.byUniqueKey(EntityLoader.java:104) at org.hibernate.loader.entity.plan.EntityLoader$Builder.byPrimaryKey(EntityLoader.java:83) at org.hibernate.loader.entity.plan.LegacyBatchingEntityLoaderBuilder$LegacyBatchingEntityLoader.<init>(LegacyBatchingEntityLoaderBuilder.java:91) at org.hibernate.loader.entity.plan.LegacyBatchingEntityLoaderBuilder$LegacyBatchingEntityLoader.<init>(LegacyBatchingEntityLoaderBuilder.java:60) at org.hibernate.loader.entity.plan.LegacyBatchingEntityLoaderBuilder.buildBatchingLoader(LegacyBatchingEntityLoaderBuilder.java:37) at org.hibernate.loader.entity.BatchingEntityLoaderBuilder.buildLoader(BatchingEntityLoaderBuilder.java:61) at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:2471) at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:2493) at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:4132) at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:4108) at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:213) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.buildSessionFactory(BaseCoreFunctionalTestCase.java:117) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.buildSessionFactory(BaseCoreFunctionalTestCase.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.hibernate.testing.junit4.TestClassMetadata.performCallbackInvocation(TestClassMetadata.java:205) ... 11 more org.hibernate.testing.junit4.CallbackException: org.hibernate.testing.junit4.BaseCoreFunctionalTestCase#buildSessionFactory at org.hibernate.testing.junit4.TestClassMetadata.performCallbackInvocation(TestClassMetadata.java:208) at org.hibernate.testing.junit4.TestClassMetadata.invokeCallback(TestClassMetadata.java:192) at org.hibernate.testing.junit4.TestClassMetadata.performCallbacks(TestClassMetadata.java:184) at org.hibernate.testing.junit4.TestClassMetadata.performBeforeClassCallbacks(TestClassMetadata.java:175) at org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:25) at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: java.lang.IllegalStateException: Attempt to register multiple SQL table aliases [usergroup3_, usergroup5_, etc] against query space uid [<gen:7>] at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.registerSqlTableAliasMapping(AliasResolutionContextImpl.java:247) at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.registerQuerySpaceAliases(AliasResolutionContextImpl.java:233) at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.generateEntityReferenceAliases(AliasResolutionContextImpl.java:126) at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.createCollectionElementAliases(AliasResolutionContextImpl.java:220) at org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl.generateCollectionReferenceAliases(AliasResolutionContextImpl.java:199) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.renderCollectionJoin(LoadQueryJoinAndFetchProcessor.java:354) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.renderJoin(LoadQueryJoinAndFetchProcessor.java:153) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoin(LoadQueryJoinAndFetchProcessor.java:128) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoins(LoadQueryJoinAndFetchProcessor.java:123) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoin(LoadQueryJoinAndFetchProcessor.java:129) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoins(LoadQueryJoinAndFetchProcessor.java:123) at org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor.processQuerySpaceJoins(LoadQueryJoinAndFetchProcessor.java:104) at org.hibernate.loader.plan.exec.internal.AbstractLoadQueryDetails.generate(AbstractLoadQueryDetails.java:157) at org.hibernate.loader.plan.exec.internal.EntityLoadQueryDetails.<init>(EntityLoadQueryDetails.java:100) at org.hibernate.loader.plan.exec.internal.BatchingLoadQueryDetailsFactory.makeEntityLoadQueryDetails(BatchingLoadQueryDetailsFactory.java:82) at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.<init>(AbstractLoadPlanBasedEntityLoader.java:102) at org.hibernate.loader.entity.plan.EntityLoader.<init>(EntityLoader.java:153) at org.hibernate.loader.entity.plan.EntityLoader.<init>(EntityLoader.java:38) at org.hibernate.loader.entity.plan.EntityLoader$Builder.byUniqueKey(EntityLoader.java:104) at org.hibernate.loader.entity.plan.EntityLoader$Builder.byPrimaryKey(EntityLoader.java:83) at org.hibernate.loader.entity.plan.LegacyBatchingEntityLoaderBuilder$LegacyBatchingEntityLoader.<init>(LegacyBatchingEntityLoaderBuilder.java:91) at org.hibernate.loader.entity.plan.LegacyBatchingEntityLoaderBuilder$LegacyBatchingEntityLoader.<init>(LegacyBatchingEntityLoaderBuilder.java:60) at org.hibernate.loader.entity.plan.LegacyBatchingEntityLoaderBuilder.buildBatchingLoader(LegacyBatchingEntityLoaderBuilder.java:37) at org.hibernate.loader.entity.BatchingEntityLoaderBuilder.buildLoader(BatchingEntityLoaderBuilder.java:61) at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:2471) at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:2493) at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:4132) at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:4108) at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:213) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.buildSessionFactory(BaseCoreFunctionalTestCase.java:117) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.buildSessionFactory(BaseCoreFunctionalTestCase.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.hibernate.testing.junit4.TestClassMetadata.performCallbackInvocation(TestClassMetadata.java:205) ... 11 more

Works fine without setting this property.

Test case: https://github.com/nikowitt/hibernate-test-case-templates/tree/HHH-12594

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Niko Wittenbeck

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

5.3.0.Final
5.2.16

Priority

Critical