Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Descriptor/Entity Event Listeners - Registering

I can't seem to find any way of registering a Descriptor Event Listener via
XML definitions. The only documentation on the Wiki is how to do it
programmatically. Is there a way to do it declaratively?

I am attempting to register an Entity Event Listener, but it isn't actually
working. My orm.xml file:

<entity name="Customer" class="CustomerImpl" metadata-complete="true" >
    <table name="customers">
        <unique-constraint>
	    <column-name>id</column-name>
	</unique-constraint>
    </table>
	
    <entity-listeners>
        <entity-listener class="EntityDynamicSchemaSupport"/>
    </entity-listeners>
    <attributes>
        <id name="id">
	    <column name="id" unique="true" nullable="false" insertable="true"
updatable="true" />
	        <generated-value generator="CustomerSequence" />
        </id>
	<basic name="customerNumber">
	    <column name="cust_number" unique="true" nullable="false"
insertable="true" updatable="true"/>
	</basic>
	<basic name="name">
	    <column name="name" unique="false" nullable="false" insertable="true"
updatable="true" length="50"/>
        </basic>
    </attributes>
</entity>



And this is my Entity Listener object:



public class EntityDynamicSchemaSupport extends EntityListener {
	
    public EntityDynamicSchemaSupport() {
        super(CustomerImpl.class);
    }
	
    @Override
    public void preInsert(DescriptorEvent event) {
        super.preInsert(event);
    }

    @Override
    public void preWrite(DescriptorEvent event) {
        super.preWrite(event);
    }
}


I'm just trying to see how it works for the moment and see the Event
attributes, but when i debug an insert, it never hits these methods. Any
ideas?

-B
-- 
View this message in context: http://old.nabble.com/Descriptor-Entity-Event-Listeners---Registering-tp26515926p26515926.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top