Esteban Maringolo
unread,Nov 23, 2020, 5:27:16 PM11/23/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message as abuse
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to GLORP Mailing List
Hi,
I was getting some issues with objects lazily initialized that forced
a read during the commit phase, triggering an exception.
Since I couldn't fix that, I did a little modification of the
architecture to delegate that lazily initialized collection to another
component, and then the issue happened again, to simplify it and make
it even faster, I performed a simple retrieve to fetch just one value
from the DB.
E.g.
query := SimpleQuery
readOneOf: GwPlayerHandicap
where: [ :each | each player = aGwPlayer AND: [ each date <= aDate ] ].
query orderBy: [ :each | each date descending ].
query retrieve: [ :each | each value ].
The weird thing is that when retrieve that single value (an Integer in
this case) it attempts to register in vía `privateRegisterAsOld:
anObject`, which IMO is meaningless, since such an object won't be
mapped to the database in any way.
GlorpSession>>privateRegisterAsOld: anObject
"Register the object as something we already read from the database,
skipping the isNew: test. Private! Normally you would just use
register:"
| realObject |
currentUnitOfWork isNil ifTrue: [^self].
realObject := self realObjectFor: anObject ifNone: [^self].
currentUnitOfWork register: realObject
I added a break condition before that, in this case for two simple
value objects and this solved the issue:
GlorpSession>>privateRegisterAsOld: anObject
| realObject |
currentUnitOfWork isNil ifTrue: [^self].
realObject := self realObjectFor: anObject ifNone: [^self].
(realObject isString or: [ realObject isNumber ]) ifTrue: [ ^self ].
currentUnitOfWork register: realObject
Am I missing something here?
Esteban A. Maringolo