2.3. Event listeners

download PDF
Hibernate Entity Manager needs to enhance Hibernate core to implements all the EJB3 semantics. It does that through the event listener system of Hibernate. Be careful when you use the event system yourself, you might override some of the EJB3 semantics. A safe way is to add your event listeners to the list given below.
Table 2.2. Hibernate Entity Manager default event listeners
Event Listeners
flush org.hibernate.ejb.event.EJB3FlushEventListener
auto-flush org.hibernate.ejb.event.EJB3AutoFlushEventListener
delete org.hibernate.ejb.event.EJB3DeleteEventListener
flush-entity org.hibernate.ejb.event.EJB3FlushEntityEventListener
merge org.hibernate.ejb.event.EJB3MergeEventListener
create org.hibernate.ejb.event.EJB3PersistEventListener
create-onflush org.hibernate.ejb.event.EJB3PersistOnFlushEventListener
save org.hibernate.ejb.event.EJB3SaveEventListener
save-update org.hibernate.ejb.event.EJB3SaveOrUpdateEventListener
pre-insert, org.hibernate.valitator.event.ValidateEventListener
pre-insert, org.hibernate.valitator.event.ValidateEventListener
post-delete org.hibernate.ejb.event.EJB3PostDeleteEventListener
post-insert org.hibernate.ejb.event.EJB3PostInsertEventListener
post-load org.hibernate.ejb.event.EJB3PostLoadEventListener
post-update org.hibernate.ejb.event.EJB3PostUpdateEventListener
Note that the JACC*EventListeners are removed if the security is not enabled.
You can configure the event listeners either through the properties (see Section 2.2, “Configuration and bootstrapping”) or through the Ejb3Configuration.getEventListeners() API.
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.