BasicHibernateAnnotationsTest.testFilterOnCollection fails on jdk8
Description
org.hibernate.test.annotations.entity.BasicHibernateAnnotationsTest ./gradlew hibernate-core:test -Dtest.single=entity/BasicHibernateAnnotationsTest --stacktrace fails on jdk8, passes on jdk7
Activity
Martin SimkaMay 20, 2014 at 10:57 AM
and it fails also on oracle databases
Martin SimkaMay 20, 2014 at 10:56 AM
for the record, on jdk8 it fails with h2, postgresqlplus92, postresql92, mysql55 and it hangs with db2-97, db2-10, mssql2008r2, mssql2012, sybase157
Brett MeyerApril 7, 2014 at 6:19 PM
Just to re-iterate, it's a test-only fix for something BasicHibernateAnnotationsTest was doing incorrect to begin with, just simply exposed by jdk8.
Brett MeyerApril 7, 2014 at 5:20 PM
Edited
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).
org.hibernate.test.annotations.entity.BasicHibernateAnnotationsTest
./gradlew hibernate-core:test -Dtest.single=entity/BasicHibernateAnnotationsTest --stacktrace
fails on jdk8, passes on jdk7