5.2.15 regression: 'could not resolve property: attributes of: org.hibernate.test.inheritance.discriminator.JoinedInheritanceTest$BaseEntity' with FetchType.EAGER

Description

Upgrading hibernate-core-5.2.13 to 5.2.14 recently failed due to https://hibernate.atlassian.net/browse/HHH-12333 reported by me and https://hibernate.atlassian.net/browse/HHH-12332.

Now, in hibernate-core 5.2.15 these issues seem to be fixed. However, a new one arises.

Stack trace:

You can simply reproduce it by changing EntityA to use FetchType.EAGER instead of FetchType.LAZY in your JoinedInheritanceTest like so:

Environment

WildFly 11/12, Java 9

Activity

Show:
Christian Beikov
March 9, 2018, 10:06 AM

I'll explain what is happening for documentaiton purposes. Since eager fetching is activated it tries to pre-render the SQL for the entities during boot time. Before the fix, a random Type (i.e. one of the attribute types from one of the subtypes) is registered for attributes like relation or attributes on BaseEntity. This means that, when loading BaseEntity via entityManager.find(BaseEntity.class, 123) it would be random, which one of the relations is loaded. With the fix, we register null to signal that the attribute has to be handled specially. Apparently, I missed to handle this properly for this kind of usage. I only handled the usage in queries.

Christian Beikov
March 10, 2018, 11:28 PM

I have a fix for this here: https://github.com/hibernate/hibernate-orm/pull/2190
I'm still waiting for this matter being discussed on the mailing list. Could you test it and give me feedback? I hope this will be the last problem. The code in the PR reverts back to non-determinism in some edge cases like before.

cnsgithub
March 13, 2018, 8:20 AM

I merged your fix in hibernate-core-5.2.16-snapshot and can confirm that it works correctly again. Thanks for fixing it, great work.

Will your fix be contained in 5.2.16? And if so, when will 5.2.16 be released?

Greets to Austria

Andrea Boriero
March 19, 2018, 1:22 PM

Hi ,

5.2.16 will contain the fix for this issue and I'm planning to release it by the end of this week.

if you have time can you please give a try to https://github.com/hibernate/hibernate-orm/pull/2208, it is a variation of the original PR.

Thanks a lot

cnsgithub
March 21, 2018, 3:00 PM

Hi Andrea Boriero,

I also merged your modified fix and things are still working. So I would stop now. Remember: everything should be made as simple as possible, but not simpler.

Greets to London

Assignee

Christian Beikov

Reporter

cnsgithub

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.2.13

Components

Affects versions

Priority

Major
Configure