cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Zeigler <robert.zeig...@roxanemy.com>
Subject Re: Multithreaded application trouble with contexts
Date Thu, 17 Nov 2011 03:15:16 GMT
You said "I have that fixed" but you don't say how; also, is the exception you are seeing now
related to the shared URLs? 

In any event, you need a call to ObjectContext.localObject to resolve the error you are seeing.


Robert

On Nov 16, 2011, at 11/165:00 PM , Richard Frovarp wrote:

> I'm trying to write a multithreaded crawler using Cayenne. I previously had it working
with Torque.
> 
> I'm writing different information out to the database (and Solr). Some of the information
is used by multiple threads, and should only be created if it doesn't already exist in the
db. Outgoing links is the one that is giving trouble. Many of our pages point to the same
link, so it should use that same reference in the database if one exists. If one does not
exist, it should create it. Further actions should check for existence.
> 
> If I don't commit the context frequently enough, it starts attempting to insert duplicate
URLs. I have that fixed, but now am getting this sort of message:
> 
> Cannot set object as destination of relationship toResource because it is in a different
ObjectContext
> 
> What's the best strategy for doing frequent updates to the database with multiple threads?
> 
> I am beginning to think I'm headed down the wrong path and should switch to something
else completely to store this data, such as NoSQL.


Mime
View raw message