Hi Jakob,

I guess it makes sense to call afterStore only if auto-update is true.
I do not really know what ODMG has to say on this, especially since we
avoid using the ODMG collections (DList, etc) since we do not want to
"pollute" our object model with classes of the persistence mechanism.

We will resort to explicitly deleting the removed objects with
db.deletePersistent() (which is basically the same as tx.markDelete()
I guess). This seems to be the most stable solution.

There is a tiny glitch in ObjectEnvelopeTable's reorder mechanism
though: If I mark an object in a collection to be deleted _and_ at the
same time remove it from the collection (to keep the object model in
sync with the DB), reorderCollection will not find the removed object
any more and will not move the delete operation up in the operation
order. If the containing object (which holds the collection) is
deleted in the same transaction, a FK violation will occur...

Thanks for looking into this!
Gerhard

On Tue, 05 Oct 2004 22:35:36 +0200, Jakob Braeuchi <[EMAIL PROTECTED]>
wrote:

>hi gerhard,
>
>this is eventually my fault. in PBImpl#storeCollection i call afterStore only if 
>  auto-update is set:
>
>....
>  // BRJ: only when auto-update = object (CASCADE_OBJECT)
>  //
>  if ((cod.getCascadingStore() == ObjectReferenceDescriptor.CASCADE_OBJECT)
>     && (referencedObjects instanceof ManageableCollection))
>  {
>    ((ManageableCollection) referencedObjects).afterStore(this);
>  }
>
>odmg requires the auto-settings to be false, so afterStore is _not_ called.
>
>this change was introduced on july 26. actually i do not know, whether we should 
>go back to the old solution ???
>
>jakob
>
>Jakob Braeuchi schrieb:
>
>> hi gerhard,
>> 
>> i marked the removed object as deletable, then it worked:
>> 
>>         tx.begin();
>>         //*************************************
>>         tx.lock(fetchedGat, Transaction.WRITE);
>>         // Remove collection object
>>         tx.markDelete(fetchedGat.getCollectiblesC().remove(0));
>>         //*************************************
>>         tx.commit();
>> 
>> jakob
>> 
>> Jakob Braeuchi schrieb:
>> 
>>> hi gerhard,
>>>
>>> afterStore() is not called when using odmg (it is for pb-api !). i'm 
>>> not an odmg-expert, so i do not know if it's an error or if there 
>>> should be a different mechanism to remove those elements.
>>>
>>> jakob
>>>
>>> Gerhard Grosse schrieb:
>>>
>>>> Hi,
>>>>
>>>> we are trying to upgrade our OJB version from RC5 to 1.0.1.
>>>> We are using the ODMG API.
>>>>
>>>> In RC5, when removing items from a collection of a write-locked
>>>> object, the transaction commit deleted the removed items from the
>>>> database. This does not seem happen any more in v1.0.1. All that is
>>>> sent to the DB is an (unnecessary) SQL UPDATE on the locked object
>>>> that actually does not change anything.
>>>> Debugging showed that the collection class is a materialized ListProxy
>>>> holding a RemovalAwareCollection (as expected). Also as expected, the
>>>> allObjectsToBeRemoved member of this RemovableAwareCollection contains
>>>> the items to be removed. However the items do not get removed during
>>>> the transaction commit, and after commit the allObjectsToBeRemoved
>>>> member still contains the same items. We also tried write-locking all
>>>> collection items and doing a flush at various points, but no luck.
>>>>
>>>> How should we remove items from a collection with ODMG in OJB 1.0.1?
>>>>
>>>> Thanks for any help!
>>>> Gerhard
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 



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

Reply via email to