5.2. Callbacks and listeners inheritance

download PDF
You can define several entity listeners per entity at different level of the hierarchy.You can also define several callbacks at different level of the hierarchy. But you cannot define two listeners for the same event in the same entity or the same entity listener.
When an event is raised, the listeners are executed in this order:
  • @EntityListeners for a given entity or superclass in the array order
  • Entity listeners for the superclasses (highest first)
  • Entity Listeners for the entity
  • Callbacks of the superclasses (highest first)
  • Callbacks of the entity
You can stop the entity listeners inheritance by using the @ExcludeSuperclassListeners, all superclasses @EntityListeners will then be ignored.
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.