ValidatePreInsertEventListener and ValidatePreUpdateEventListener are empty classes. They both inherits from ValidateEventListener.
In my case with 400 classes in my domain, each listener take around 15 Mo of memory.
Instead of creating two listeners, one for update and one for insert, I can create only one and share it betwwen post-insert and post-update.
Can somebody tell me if this is correct or not. Is there something I miss that prevent me from sharing my listener ?
I am using spring to configure my session factory so here is my configuration :
Code:
<bean id="validateListener" class="org.hibernate.validator.event.ValidateEventListener" />
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="eventListeners">
<map>
<entry key="pre-update" value-ref="validateListener"/>
<entry key="pre-insert" value-ref="validateListener"/>
</map>
</property>
<!-- fichiers de mapping d'hibernate -->
<property name="mappingResources">
<list>
<value>...</value>
</list>
</property>