Failure with entity relationship using discriminator formula

Description

Hibernate has introduced a new code snippet in AnnotationBinder.processElementAnnotations, that validates if the properties are inherited from a super class. If they are inherited, then remaining part of the method is not executed. In our case, it ignores a property as it is coming from a mapped super class. But, it remains ignored and never gets to the place where it is needed. In simple terms, this property comes neither from mapped super class nor from the sub class (ignored by both, assuming the other one processes it). Attached file shows how the entity is related. The error happens when the Notary entity is one-to-one mapped with Person entity on person_id column. Person_id column is not getting recognized from the Person entity hierarchy and exception is thrown (Not a single mapped property exception message)

Environment

Java: 1.8
Spring:

Activity

Show:
Arun S
January 3, 2018, 7:18 AM

Thanks Gail for looking into it. But this issue is different from HHH-9485. Here, it happens due to an additional validation added inside AnnotationBinder.processElementAnnotations in newer versions of hibernate. And the error message is Not a single mapped property. I have added a test case to replicate the issue

Arun S
January 3, 2018, 7:21 AM

Can someone help to change the status from "Awaiting Test Case" to "In Progress". I have added the test case to the issue 2 weeks back. But the status has not changed and I don't seem to have access to do so

Swen Fiebig
January 22, 2018, 2:09 PM

Can someone please look into this one?

Chris Cranford
January 22, 2018, 8:23 PM

One way I found to get this to work was to explicitly specify the targetEntity on the @OneToOne as follows:

, while the above works and the supplied test case works without failure, should the mapping work without the explicit targetEntity attribute?

Gail Badner
January 23, 2018, 1:43 AM

, I see that targetEntity = ActualPerson.class also works.

An @AttributeOverride should have been added to {ActualPerson to override the column mapping for #personId instead of adding the property, but I see that results in the same failure. I'm guessing that ActualPerson#personId was added to workaround the same failure in an earlier version.

I think this should work with out an explicit targetEntity attribute.

Assignee

Unassigned

Reporter

Arun S

Fix versions

None

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.1.0

Components

Affects versions

Priority

Major
Configure