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 <[email protected]> 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 > >
