Hi,
Using the LoadEventListener I get notified if an entity is loaded from persistent storage. However, I do not get a notification if an element (composite-element) of a set is loaded. Is there a way to get events for each single element of a collection? I could use the InitializeCollectionEventListener, access the collection thru the event parameter in the listener method, then apply an instanceof check to find out the type of collection an then iterate over each element, but I am looking for a smoother way to do this (preferably I get en event for each element in the collection when it is loaded).
I get a load event when Person object is loaded, but not when a PhoneNumber is loaded.
Thank you for any help
--bruno
Hibernate version:3.1
Mapping documents:
<hibernate-mapping package="ch.hsr.myapp">
<class name="Person" table="People" lazy="false">
<id name="ID" type="long" unsaved-value="null">
<column name="ID" not-null="true"/>
<generator class="sequence">
<param name="sequence">S_People</param>
</generator>
</id>
<property name="lastName" not-null="true"/>
<property name="firstName" not-null="true"/>
<property name="nickname"/>
<property name="birthDate"/>
<property name="notes">
<column name="Notes" sql-type="text"/>
</property>
<component name="address">
<property name="street" column="Street"/>
<property name="streetNumber" column="StreetNo"/>
<property name="ZIPCode" column="ZIPCode"/>
<property name="region" column="Region"/>
<property name="country" column="Country"/>
</component>
<set name="phones" table="PersPhones" lazy="false" cascade="all-delete-orphan">
<key column="PersID"/>
<composite-element class="PhoneNumber">
<property name="country"/>
<property name="region"/>
<property name="localNumber"/>
</composite-element>
</set>
</class>
</hibernate-mapping>
Name and version of the database you are using:PostgreSQL 8.x
|