[hibernate-issues] [JIRA] (HHH-13887) Multiple @PostLoad (in @Entity and @MappedSuperclass)

Stefan Lindner (JIRA) jira at hibernate.atlassian.net
Tue Mar 3 17:33:36 EST 2020


Stefan Lindner ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A25d0eef4-5c83-4cc8-a430-09047271e2ad ) *updated* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNjA2YWI1ODk4MGI4NDgzMWIxNzA4ODQ2NmQyNTcyNGUiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13887?atlOrigin=eyJpIjoiNjA2YWI1ODk4MGI4NDgzMWIxNzA4ODQ2NmQyNTcyNGUiLCJwIjoiaiJ9 ) HHH-13887 ( https://hibernate.atlassian.net/browse/HHH-13887?atlOrigin=eyJpIjoiNjA2YWI1ODk4MGI4NDgzMWIxNzA4ODQ2NmQyNTcyNGUiLCJwIjoiaiJ9 ) Multiple @PostLoad (in @Entity and @MappedSuperclass) ( https://hibernate.atlassian.net/browse/HHH-13887?atlOrigin=eyJpIjoiNjA2YWI1ODk4MGI4NDgzMWIxNzA4ODQ2NmQyNTcyNGUiLCJwIjoiaiJ9 )

Change By: Stefan Lindner ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A25d0eef4-5c83-4cc8-a430-09047271e2ad )

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.

h3. This does not work

*SuperClass.java*

{code: title=SuperClass. java |borderStyle=solid }
@MappedSuperclass
public abstract Superclass {

@PostLoad
public void postLoad() {
System.out.println("Superclass.postLoad");
}
}
{code}

*EntityClass.java*

{code: title=EntityClass. java |borderStyle=solid }
@Entity
public class EntityClass extends SuperClass {
@PostLoad
public void postLoad() {
System.out.println(" Superclass EntityClass.postLoad");
}
}
{code}

h3. This works

*SuperClass.java*

{code: title=SuperClass. java |borderStyle=solid }
@MappedSuperclass
public abstract Superclass {

@PostLoad
//          |||||||||||||
//          VVVVVVVVVVVVV
public void otherPostLoad() {
System.out.println(" EntityClass Superclass.postLoad");
}
}
{code}

*EntityClass.java*

{code: title=EntityClass. java |borderStyle=solid }
@Entity
public class EntityClass extends SuperClass {
@PostLoad
public void postLoad() {
System.out.println("EntityClass .postLoad");
}
}
{code}

( https://hibernate.atlassian.net/browse/HHH-13887#add-comment?atlOrigin=eyJpIjoiNjA2YWI1ODk4MGI4NDgzMWIxNzA4ODQ2NmQyNTcyNGUiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13887#add-comment?atlOrigin=eyJpIjoiNjA2YWI1ODk4MGI4NDgzMWIxNzA4ODQ2NmQyNTcyNGUiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100121- sha1:a532aba )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200303/ebcf53ed/attachment.html 


More information about the hibernate-issues mailing list