Log a warning instead of throwing an Exception when @AttributeOverride is used in conjunction with inheritance

Description

This issue is a spin-off of https://hibernate.atlassian.net/browse/HHH-12609
As discussed there when the user is using Inheritance strategy TABLE_PER_CLASS it is a perfectly valid case, but instead the current implementation in 5.3 throws an exception (5.2 works fine though). To fix this I have added an extra check - please see https://github.com/hibernate/hibernate-orm/pull/2706

Environment

None

Activity

Show:
Andrei Ivanov
December 21, 2018, 8:16 PM

And a bit off topic, the Log4j JPA appender broke too , but that's using SINGLE_TABLE

Gail Badner
December 22, 2018, 6:57 AM

, I understand that no exception was thrown in 5.2. Did an @AttributeOverride actually work properly when mapped on an entity class in a TABLE_PER_CLASS hierarchy? It would help a lot if you could add a test case to your PR that shows that it is actually working (overriding the column name) with your fix.

, According to the spec, @Inheritance(...) "is specified on the entity class that is the root of the entity class hierarchy". The spec also says a mapped superclass "is not itself an entity". IOW, a mapped superclass should not be annotated with @Inheritance. SINGLE_TABLE is the default for inheritance hierarchies, so simply removing @Inheritance(strategy = InheritanceType.SINGLE_TABLE) from AbstractLogEventWrapperEntity should fix that.

Andrei Ivanov
December 22, 2018, 7:12 AM

The problem is that I'll have to convince the Log4J team the change is necessary, even though it works with Hibernate versions earlier than 5.4 and with Eclipselink, and it will takr a very long time to get a release with such changes 😟
I really was hoping to be able to switch to Java 11 soon.

Petar Tahchiev
December 23, 2018, 2:37 AM

Hi @GailBadner, no in 5.2.x the @AnnotationOverride had no effect. Then in 5.3.x it started throwing exception. This ticket tackles the exception. Shall I raise another one for the AnnotationOverride not working, or can we address it here?

Gail Badner
February 19, 2019, 5:13 PM

Fixed in 5.3 branch as well.

Fixed

Assignee

Guillaume Smet

Reporter

Petar Tahchiev

Fix versions

Labels

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major