The mikalai Zaikin Notes States
"A class is permitted to override an inherited callback method of the same callback type, and in this case, the overridden method is NOT invoked."
However in the example given, the overriden method is invoked...
@Entity
public class Animal {
....
@PostPersist
protected void postPersistAnimal() {
System.out.println("Inside Animal.postPersistAnimal()");
}
}
@Entity
@EntityListeners({CatListener.class, CatListener2.class})
public class Cat extends Pet {
...
}
@EntityListeners(SiameseCatListener.class)
@Entity
public class SiameseCat extends Cat {
...
@PostPersist
protected void postPersistAnimal() {
System.out.println("Inside SiameseCat.postPersistAnimal()");
}
}
Here the overridden method SiameseCat.postPersistAnimal() is called and Animal.postPersistAnimal() is not at all called.