YK and Chris Thanks for your replies. I already have the cayenne filter installed, and the datacontext is accessible via
BaseContext.getThreadObjectContext(); but this is not the problem. The problem is that cayenne objects referenced from models sometimes (eg when browsing to versioned pages) end up in a hollow state, probably due to deserialization. It is similar to the problem discussed here http://comments.gmane.org/gmane.comp.java.cayenne.user/12017 I solved the problem with models using loadable detachable models, but I am fearing the same problem may show up with cayenne objects that are stored in my session (i am using my own session class with references to cayenne objects, installed with getWebSessionClass()) Thanks, David On Fri, Apr 15, 2011 at 8:41 PM, Christian Grobmeier <[email protected]>wrote: > Hi, > i have solved it like this: > > http://www.grobmeier.de/using-apache-cayenne-with-apache-wicket-05022011.html > Cheers > Christian > > On Fri, Apr 15, 2011 at 8:20 PM, YK <[email protected]> wrote: > >>the datacontext was lost > > > > I think this is the root cause of your problems. > > > > A cayenne dataContext is generally created once for all for each web > session > > where it is stored. > > You should have a http://cayenne.apache.org/doc30/tutorial-webapp.htmlweb > > filter that stores this dataContext in the ThreadLocal context in order > to > > use it > > in the persistence layer of your application like the following : > > ObjectContext context = BaseContext.getThreadObjectContext(); > > List artists = context.performQuery(query); > > > > Make sure you are not loosing the dataContext after each request. > > > > take a look at http://cayenne.apache.org/doc30/tutorial-webapp.htmlthis > > link for more information > > > > > > -- > > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-Sessions-serialization-and-Cayenne-tp3452466p3452694.html > > Sent from the Users forum mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > > > -- > http://www.grobmeier.de > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
