Hi All!
I have object System, it has collection of SubSystems.
When I create new SubSystem, I add it to System's collection.


      tx.begin();

      System system = getByIdentity( 1, System.class );
      Collection subSystems = system.getSubSystems();
      subSystems.add( new SubSystem() );

      tx.commit();

After saying commit, ALL(!) objects in subSystems collection are
updated. I think it's not good. What can you say about it?


PersistentBorekerImpl:
private void store(Object obj, boolean insert, Map markedForStore)
{
......
            storeCollections(
                    obj,
                    cld.getCollectionDescriptors(),
                    markedForStore);
}

storeCollections() iterates over all objects in collection, and stores
all the objects in it. :(
May be the dirty check mentioned below will help?


Thomas Mahler wrote:
>Hi Winson,

>The layerered approach of OJB delegates such optimizations to the high
>level APIs ODMG, JDO and OTM.
>That is on the PersistenceBroker there is no such tracking.
>But on the ODMG and JDO level you have full object level transactions.
>There is some further explanation on this topic in the FAQ.

>The PersistenceBroker provides the notion of an ObjectModification that
>  contains hint information if an object needs insert or update.

>So IMO there no need to add anything.

>cheers,
>Thomas

>Winson Quock wrote:
> Hello,
> 
> Looks like to me that OJB allows configuration of whether to store a related 
> object automatically, but it does not attempt to figure out if the related 
> objects are changed, i.e. we need some kind of dirty-flag mechanism, for 
> optimization.
> 
> I suggest we add an interface "ChangeTrackedObject" like
> 
> interface ChangeTrackedObject {
>       bool isChanged();
> }
> 
> when we store we check if we can:
> 
> if (obj instanceof ChangeTrackedObject) {
>       if (!((ChangeTrackedObject)obj).isChanged()) {
>               // no change
>               return;
>       }
> }
> 
> The data object is responsible for tracking the changes.
> 
> What do you think?
> 


  

 
Best regards,
Andrey Chernyh<[EMAIL PROTECTED]>
Plesk Inc.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to