Hibernate version: 3.2.1
Mapping documents:
Code:
<class name="User" table="`USERS`">
<id name="userName" column="USERNAME"/>
<!-- mapping a value collection -->
<list name="nickNames" table="USER_NICKNAMES"
collection-type="ca.odell.glazedlists.hibernate.EventListType">
<key column="USER_ID"/>
<list-index column="DISPLAY_ORDER"/>
<element column="NAME" type="string" length="50"/>
</list>
</class>
I have two questions with regard to the implementation of a UserCollectionType for a BasicEventList of the GlazedLists project
http://www.publicobject.com/glazedlists/.
The current state of this EventListType and the corresponding PersistentEventList is available here:
https://glazedlists.dev.java.net/source ... hibernate/This solution basically works as shown above with a mapping example.
There are two problems remaining:
1.) customizing EventList creation
The EventListType is responsible for creating the PersistentCollection and the wrapped collection, in this case a BasicEventList.
There are situations where we want to customize the creation of the EventLists, for example pass in a dedicated ReadWriteLock object.
Therefore, it would be helpful, if the CustomCollectionType EventListType could implement
Code:
org.hibernate.usertype.ParameterizedType
to pass in some external parameters. But this isn't supported currently, correct?
Would it be possible to implement this enhancement in Hibernate?
2.) transparent lazy loading of list elements
EventLists fire events to attached ListEventListeners when adding, removing or setting list elements.
When Hibernate loads the elements and fills the list during initialization, already attached list event listeners will receive corresponding events, which isn't desired in this case.
The idea is to temporarily disable the event notification during list initialization and enable it again afterwards.
What are the correct methods to implement/override in PersistentEventList?
My guess would be:
Code:
void beforeInitialize(CollectionPersister persister, int anticipatedSize)
boolean afterInitialize()
Is this correct or is there another way to accomplish this?
Thanks for your help,
Holger