Exclusive collection deletes

Skip to first unread message

Esteban Maringolo

Nov 18, 2020, 11:02:21 AM11/18/20
to GLORP Mailing List

I'm having an issue with elements added to a collection that is part
of an exclusive mapping that are always deleted.

I have a GwTournament that has a collection of aGwTournamentCategory,
but when I add a category to this collection, at the moment of
committing the unit of work the row is marked for deletion.

Getting into `UnitOfWork>>computeCollectionDeletesFor: aMapping
inObject: anObject` I notice that the memento and the object memento
are the same object, and so is the the value read using the mapping.

This causes all elements to be removed when the UOW is committed, I
don't know why this is so.

aDescriptor toManyMapping
attributeName: #categories;
referenceClass: GwTournamentCategory;
collectionType: SortedCollection;
orderBy: [ :each | (each getTable: 'GWTOURNAMENTCATEGORY') getField:
'position' ];
from: (table fieldNamed: 'id')
to: ((self tableNamed: 'GWTOURNAMENTCATEGORY') fieldNamed:

If I remove the "beExclusive" then this doesn't happen anymore but it
causes the opposite situation: for some reason the elements are
removed from the collection, but never deleted from the DB, and new
elements are added each time.


Esteban A. Maringolo

Esteban Maringolo

Nov 18, 2020, 11:29:15 AM11/18/20
to GLORP Mailing List

Answering myself, I noticed that in Pharo's SortedCollection, the
elements are inside another collection, so a #removeAll replaces this
internal collection by another, empty, one. For some reason this might
mess with something, but replacing the collection to be an
OrderedCollection solved the issue.


Esteban A. Maringolo

Alan Knight

Nov 18, 2020, 11:44:54 AM11/18/20
to glorp...@googlegroups.com
Ah, that makes sense. There's dialect-specific code to deal with different collection representations, but it probably never got done for Pharo SortedCollection.

You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glorp-group...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAJMgPC%2BU-B-vHuBMzEbx7Awf0X7swKd5YmkbT5_nCj3hJ5xR-w%40mail.gmail.com.
Reply all
Reply to author
0 new messages