Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0AB34E467 for ; Thu, 14 Feb 2013 15:25:02 +0000 (UTC) Received: (qmail 28271 invoked by uid 500); 14 Feb 2013 15:25:01 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 28099 invoked by uid 500); 14 Feb 2013 15:25:01 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 28081 invoked by uid 99); 14 Feb 2013 15:25:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2013 15:25:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of johnthuss@gmail.com designates 209.85.214.41 as permitted sender) Received: from [209.85.214.41] (HELO mail-bk0-f41.google.com) (209.85.214.41) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2013 15:24:55 +0000 Received: by mail-bk0-f41.google.com with SMTP id q16so1143288bkw.0 for ; Thu, 14 Feb 2013 07:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=EA+CNdEuSF5e0eBVbioCULGAX3DeRNcw5O2QlgzhAr0=; b=SVWrGwg8QgJ/7xoaz13g1ImQnP98bWqC/SaK5WgF93BVEePGoq9wN+zXn5EZcKHW8B xWAcqMExl80dsLW57skA2N26W7C/ZWfWqP02Do6l/oa8uvuFHsEUw246rxVQUinsr8VY lgAYraxm/3rOkmqdgEPedmT/SHJvgxLw1qR/di2YBjLA4m4uF18Sdh4vFV8DZWrTrXET eOAFabAioD39jnzhgqYBoT91J3mFB5hTxEq6HjBMYfUNQ+OlGhTCdfxY1UAcvtjh4aDq nQarLzJX0dHoLKgHC8jw3RV5WNobyyPWhul3R+txYbrqnh/R1fIuN3rF/7GWtTcxnfsU YPow== MIME-Version: 1.0 X-Received: by 10.204.7.195 with SMTP id e3mr8164834bke.115.1360855474651; Thu, 14 Feb 2013 07:24:34 -0800 (PST) Received: by 10.204.157.148 with HTTP; Thu, 14 Feb 2013 07:24:34 -0800 (PST) In-Reply-To: References: Date: Thu, 14 Feb 2013 09:24:34 -0600 Message-ID: Subject: Re: BaseContext From: John Huss To: "user@cayenne.apache.org" Content-Type: multipart/alternative; boundary=00151750e9502843b404d5b0db2b X-Virus-Checked: Checked by ClamAV on apache.org --00151750e9502843b404d5b0db2b Content-Type: text/plain; charset=ISO-8859-1 Try: parentObject = myNewContext.localObject(parentObject); Then proceed with the rest. Then both objects will be in the same ObjectContext. On Thu, Feb 14, 2013 at 9:08 AM, Rich Tuers wrote: > >Hello, > > > >We are using Cayenne 3.0 and recently implemented the > >WebApplicationContextFilter and we are using > >BaseContext.getThreadObjectContext(). > > > >This is working great for our JSF Web Application. However we introduced > >Apache Camel into our tech stack. Our Front-End Web Application post a > >message to a queue that our backend picks up, processes the request and > >then puts the return results back on a queue which the front end is > >listening too. When the Front-End receives the information I then want > >to insert new records into the database. Therefore I try to get a > >BaseContext.getThreadObjectContext() however it throws a > >"java.lang.IllegalStateException: Current thread has no bound > >ObjectContext". So it appears the there is no ThreadLocal to attach to > >and we are likely outside of the WebApplicationContext. Everything works > >great, when I am within our JSF application flow. > > > >I've tried to catch the illegal state error and then return a > >DataContext.createDataContext(). Unfortunately this did not work > >either, I get an error saying something like "the object is not part of > >this DataContext". So I already have the parent object from the original > >request, I then use camel to send a request to the back-end, which > >returns me data that I need to create the children. I try setting the > >parent on the child and I get this error. > > > >So I'm not sure what to try next. Any suggestions would be greatly > >appreciated. > > > >Thank you, > >Rich > > --00151750e9502843b404d5b0db2b--