Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-13186

Multiple @PostLoad in @MappedSuperclass

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Explained
    • Affects Version/s: 18.0.1.Final
    • Fix Version/s: None
    • Component/s: JPA / Hibernate
    • Labels:
      None

      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?

      This does not work

      SuperClass.java
      @MappedSuperclass
      public abstract Superclass {
      
          @PostLoad
          public void postLoad() {
              System.out.println("Superclass.postLoad");
          }
      }
      
      EntityClass.java
      @Entity
      public class EntityClass extends SuperClass {
          @PostLoad
          public void postLoad() {
              System.out.println("Superclass.postLoad");
          }
      }
      

      This works

      SuperClass.java
      @MappedSuperclass
      public abstract Superclass {
      
          @PostLoad
          public void otherPostLoad() {
              System.out.println("Superclass.postLoad");
          }
      }
      
      EntityClass.java
      @Entity
      public class EntityClass extends SuperClass {
          @PostLoad
          public void postLoad() {
              System.out.println("Superclass.postLoad");
          }
      }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                smarlow Scott Marlow
                Reporter:
                lindner Stefan Lindner
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: