Red Hat Training

A Red Hat training course is available for JBoss Enterprise Application Platform Common Criteria Certification

5.3. XML definition

The EJB3 specification allows annotation overriding through EJB3 deployment descriptor. There is also an additional feature that can be useful: default event listeners.
<?xml version="1.0" encoding="UTF-8"?>

<entity-mappings xmlns=""
                 xsi:schemaLocation=" orm_1_0.xsd"
                <entity-listener class="org.hibernate.ejb.test.pack.defaultpar.IncrementListener">
                    <pre-persist method-name="increment"/>
    <entity class="ApplicationServer">
            <entity-listener class="OtherIncrementListener">
                <pre-persist method-name="increment"/>

        <pre-persist method-name="calculate"/>
You can override entity listeners on a given entity. An entity listener correspond to a given class and one or several event fire a given method call. You can also define event on the entity itself to describe the callbacks.
Last but not least, you can define some default entity listeners that will apply first on the entity listener stack of all the mapped entities of a given persistence unit. If you don't want an entity to inherit the default listeners, you can use @ExcludeDefaultListeners (or <exclude-default-listeners/>).