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

Multiple @PostLoad in @MappedSuperclass

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • 18.0.1.Final
    • JPA / Hibernate
    • 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");
          }
      }
      

      Attachments

        Activity

          People

            smarlow1@redhat.com Scott Marlow
            lindner-1 Stefan Lindner (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: