Multiple @PostLoad (in @Entity and @MappedSuperclass)

Description

Using @PostLoad in a @MappedSuperclass does not work it the annotated method has the same name as in @Entity class.
I did not find any hints in the specs about the behavior in this case. Is it allowed?
The SuperClass ist part of another module than EntityClass.

This does not work

SuperClass.java

EntityClass.java

This works

SuperClass.java

EntityClass.java

Environment

Adopt OPENJDK11/OpenJ9
Wildfly 18.0.1
Win 10/64bit
PÜostgreSQL 12

Activity

Show:
Nathan Xu
March 4, 2020, 7:54 PM

As per Hibernate User Guide (https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#events-jpa-callbacks-example), it seems the expected feature.

If the method name is the same, it means the method is overridden. As per the user guide, super class’s method won’t be invoked.

Steve Ebersole
March 4, 2020, 10:39 PM

As pointed out by , this works as expected

Assignee

Unassigned

Reporter

Stefan Lindner

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure