Interestingly, the reproducer uses org.hibernate.dialect.MySQL8Dialect, which is deprecated and probably shouldn’t be used. Setting the dialect to org.hibernate.dialect.H2Dialect fixes the test, but I suppose that’s beside the point since H2 is started in “MySQL mode”. Setting the dialect to org.hibernate.dialect.MySQLDialect, I get a different exception, probably because we handle IDs differently on newer versions of H2 and/or MySQL. Setting the dialect to org.hibernate.dialect.MySQLDialect and switching to MySQL (instead of H2), I actually get the same exception again. I sent a PR with everything I did to simplify your reproducer: https://github.com/ls-urs-keller/hibernate-force-initalizing-collection-problem/pull/1 |