BasicHibernateAnnotationsTest.testFilterOnCollection fails on jdk8
./gradlew hibernate-core:test -Dtest.single=entity/BasicHibernateAnnotationsTest --stacktrace
fails on jdk8, passes on jdk7
jdk 1.8 GA
and it fails also on oracle databases
for the record, on jdk8 it fails with h2, postgresqlplus92, postresql92, mysql55 and it hangs with db2-97, db2-10, mssql2008r2, mssql2012, sybase157
Just to re-iterate, it's a test-only fix for something BasicHibernateAnnotationsTest was doing incorrect to begin with, just simply exposed by jdk8.
This stems from BasicHibernateAnnotationsTest's use of isCleanupTestDataRequired == true. When that's the case, the ORM test suite attempts a "delete from java.lang.Object", relying on polymorphism to delete all data from all entities. The order of those classes are determined by a simple Map#values in SessionFactoryImpl#getImplementors. It appears JDK8 has, once again, changed iteration ordering.
Really, I'm kind of surprised this worked to begin with. Realistically, deleting from java.lang.Object doesn't typically happen anywhere outside of tests. This will be a test-only fix, forcing #testFilterOnCollection to clean up its relationships prior to the one-shot delete (more correct to begin with).