[ZODB-Dev] Commit seems to succeed but does'nt

Cyril Elkaim cyril.elkaim@free.fr
Wed, 26 Sep 2001 17:18:25 +0200


	Steve,


	Thanks, We understand now. We believed that the 'root' object was 
something special (a view of the database) but it's in fact a Persistent 
Object encompassing everything else. Is it correct ?

	Thanks,
	Cyril

Steve Alexander wrote:

> Cyril Elkaim wrote:
> Please post replies also to the zodb-dev mailing list. That way, others 
> reading can learn from the conversation, and later from the mailing list 
> archives.
> 
> 
> Here's your answer from your code. In job1, you do this:
> 
> 
>   root["JobOne" + str(i)] = "JobOne" + str(i)
> 
> In job2 you do this:
> 
>   root["JobTwo" + str(i)] = "JobTwo" + str(i)
> 
> both are modifying the root object, which I assume to be a 
> PersistentMapping.
> 
> You could get around this by adding two PersistentMappings to root:
> 
> j1=root['JobOne']=PersistentMapping()
> j2=root['JobTwo']=PersistentMapping()
> 
> Then, each job uses either j1 or j2, with no conflicts.
> 
> 
>> Steve Alexander wrote:
>>
>>> That wouldn't work in most cases. That's the point of a conflict 
>>> error: there's a conflict between what threads want to do.
>>>
>>> You'll probably want to consider how you handle conflict errors at a 
>>> "software architecture" level, rather than at an implementation level.
>>> A good architecture will help you to keep the code elegant :)
>>
> 
> 
> -- 
> Steve Alexander
> Software Engineer
> Cat-Box limited
>