Re: storing objects

Armin Waibel <[email protected]> Wed, 12 Sep 2007 18:21:33 +0200
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Hans Novak wrote:
> 
> Did you read the post from Alessandro ?
> He wrote something to catch this known problem ...
> I will try it later.
>

yep, I read it. Sorry I don't have the time to check the source code of 
this project for performance issues/bottlenecks/"bugs".

I checked method #updateCollectionReference(...):
Performs an additional DB roundup to get all persisted collection 
objects and compare these objects with objects of the reference. It 
compares the objects based on #equals(..) method. So you need a proper 
equals method implementation. It doesn't use OJB's PersistentField 
implementation
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Change+PersistentField+Class
to access the members - you need proper public setter/getter.
But generally speaking this method should do the job (as workaround till 
we fix this in OJB)

[For Alessandro]
Think this method can be improved (I don't want to criticize you ;-)). 
Use a report query an query only the PK fields of the collection. Then 
build the Identity objects and compare against the Identity objects of 
the current collection to find the deleted objects - No need for proper 
object.equals(..) method implementation of the persistence capable objects.
Use
Object value = 
FieldDescriptor/CollectionDescriptor.getPersistentField().get(source)
to read the field value of an persistence capable object.
Use PB.getDescriptorRepository() to lookup the current used 
DescriptorRepository instance.

regards,
Armin

> Hans
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
>