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 -- 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAJMgPCKpg3OGZuwU84kTnOJc2b75C8HgESvb7H_E0U2cNW5q2Q%40mail.gmail.com. |
I think the right test is that if the object doesn't have a descriptor you skip it. But I'd kind of expect register to do that anyway. Also with the initial issue, you might be able to map the field or otherwise bypass the lazy initialization so the first issue doesn't happen. On Mon, Nov 23, 2020 at 5:27 PM Esteban Maringolo <[hidden email]> wrote: Hi, 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAGWHZ9_zqq3Uezq4So%3DJH04ju7x6NSthLMZg9T82xFu7ZAOkng%40mail.gmail.com. |
Free forum by Nabble | Edit this page |