Re: CayenneRunTimeException when it's sent several requests quickly

From: Jorge Sopena (jsopen..idsa.es)
Date: Tue Mar 16 2004 - 05:55:06 EST

  • Next message: Jim Menard: "Re: Logging in Cayenne?"

    Eric,
    I just create a DatContext in my doGet() method of my servlet, in the
    following way:
           ctxt = BasicServletConfiguration.getDefaultContext(session)

    Each time I receive a request, a new DataContext would be created,
    wouldn't it?

    What my application has to do is to register these requests with the
    customer who did it.
    So I create a new Request object in that way:
        req =(Request)ctxt.createAndRegisterNewObject("Request");

    And then I set the customer to the request:
         r.setCustomer(Customer.search(clientId));

    And it's in that moment when this error happens.

    But the weird thing is that happens only when I do several request
    quickly, if they are separated in time everything goes right.

    Any hint?

    Jorge

    Eric Schneider wrote:

    >Jorge,
    >
    >Can you further describe behavior of the web application. Are you sure you
    >are using only one data context object to commit changes? Is the data
    >context a session scope variable? What presentation framework are you
    >using?
    >
    >e.
    >
    >----- Original Message -----
    >From: "Jorge Sopena" <jsopen..idsa.es>
    >To: <cayenne-use..bjectstyle.org>
    >Sent: Thursday, April 15, 2004 12:26 PM
    >Subject: CayenneRunTimeException when it's sent several requests quickly
    >
    >
    >
    >
    >>Hi,
    >>
    >>I've got a web application using Cayenne as the persistence engine.
    >>Apparently everthing goes rigth when I send request one by one.
    >>But I'm testing the performance of my app, and I send several requests
    >>quickly.
    >>All the requests are proccesed but some of the produce this error:
    >> CayenneRuntimeException.
    >> "Cannot set object as destination of relationship customer
    >>because it is in a different DataContext"
    >>
    >>When does this error happen?, and what could it be the cause?
    >>
    >>Any hint,
    >>
    >>Thanks
    >>
    >>Jorge
    >>
    >>
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Mar 16 2004 - 05:48:40 EST