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

Environment

jdk 1.8 GA
h2

Activity

Show:
Martin Simka
May 20, 2014, 10:57 AM

and it fails also on oracle databases

Martin Simka
May 20, 2014, 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 Meyer
April 7, 2014, 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 Meyer
April 7, 2014, 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).

Fixed

Assignee

Brett Meyer

Reporter

Martin Simka

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major