[OJB-developers] ProxyCollection, Refresh of Relationships
Brought to you by:
thma
From: Jakob B. <jbr...@ho...> - 2002-01-03 16:33:32
|
hi, the attached zip contains extensions based on ojb 07.277 to support proxy collections and refresh of relationships for objects found in the cache. proxy collections: this is ONE proxy for the whole collection of related objects, the proxy collection will load as soon as data is read from it, reading the size does NOT load the data (retrieving the size is done with select count(*) ). definition is on CollectionDescriptor <CollectionDescriptor id="1"> <orderby sort="asc">saldo</orderby> <cdfield.name>konti</cdfield.name> <items.class>brj.ojb.Konto</items.class> <inverse_fk_descriptor_ids>2</inverse_fk_descriptor_ids> <auto.retrieve>true</auto.retrieve> <auto.update>true</auto.update> <auto.delete>true</auto.delete> <lazy>true</lazy> <<<<< lazy uses proxy collection </CollectionDescriptor> refresh relationships: the current implementation of ojb does not do this, when the RSIterator finds an object in the cache. i had a problem with sorted realtionships when the sort attribute was updated. definition is on ClassDescriptor, it could later be moved to the Relationship itself to allow finer control of the behaviour. as an alternative the query could provide a refresh feature. anyway, my current solution is simple and refreshes all relationships of a class. <ClassDescriptor id="1"> <class.name>brj.ojb.Person</class.name> <table.name>tabPerson</table.name> <conversionStrategy>brj.ojb.ConversionStrategy</conversionStrategy> <refreshRelationships>true</refreshRelationships> <<<<< refresh <FieldDescriptor id="1"> <field.name>id</field.name> jakob |