Glorp misses updates of 1:1 relationships - any ideas?

8 views
Skip to first unread message

jtuchel

unread,
Oct 1, 2025, 2:40:57 AMOct 1
to glorp-group
Hi there,

I am facing problems with some ToOneRelationships missing updates and although I tried debugging these situations for hours, I found no hint as to what goes wrong. 

Let me explian a little:
I have an object, say customer which has an address. When I update a Customer (existent in the Database) by setting its address (new), most of the times an UPDATE to the Customer is sent to the Database. But in some cases, it seems Glorp misses the change to the #address inst var and doesn't update it the Customer. It does, however, do an INSERT of the new address.... most of the times, but sometimes it even misses this. 
Sometimes, I do the same operation twice and the first one fails and the second works...(???)

So I know I am screaming into an empty echo chamber, but hope dies last ;-)

Does anyone have any experience with this phenomenon? Any ideas what to check specifically? Maybe even a fix on any of the Smallotalks?


Joacihm

 

Alan Knight

unread,
Oct 2, 2025, 10:49:28 AMOct 2
to glorp...@googlegroups.com
So, what happens in Glorp.
Objects are registered with the unit of work. When they are, Glorp shallow copies them into a Map.
When you commit, it looks for connected objects. So it ought to find the change to that inst var and register the new address.
It takes all the objects it knows about and writes a RowMap. Then it takes the shallow copies and generates a RowMap for them, representing the old state.
Then it looks for differences.
Then it generates SQL for those differences, using an insert if the row wasn't there before, and an update if it was.

So something could be weird with the hashing (the intermittent nature suggests maybe that, but it's a wild guess). But you could try to see if it's happening in terms of the objects, in terms of generating the row map, or in terms of the differences.
There are debugRead and debugWrite properties you can set on the mapping to get you a debugger when it's happening. And I think there might be some logging you could enable, but it's been a while. Or you could add some.


--
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 visit https://groups.google.com/d/msgid/glorp-group/77f464e5-6609-4ae9-92f2-a9cdfbbd5e7dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages