Hi Christian, In case of Web application it is incorrect to have one ObjectContext, because you can't really know which session added certain changes, so you'll be facing tons of multithreading issues, e.g. one session will commit other session's partial changes. Common way is to have one context per session, and for easy access to it having it bound to your servlet's thread. See http://cayenne.apache.org/doc30/web-applications.html
Hope that helps, Andrey 2011/2/16 Christian Grobmeier <grobme...@gmail.com>: > Hello, > > sorry, a dumb question: > > do I need a ObjectContext per thread or per app? > > In fact I wrote a spring bean (its a singleton) which creates one > single ObjectContext for all my app. In other terms, multiple threads > will use it to insert, read, commit etc. > Since ObjectContext offers the commit method, I am now doubting if > this was correct. I feel it might be good to have an ObjectContext for > each thread/user. Or does the ObjectContext know what happened as one > transaction? > > Can you advise? > > Thanks > Christian > > -- > http://www.grobmeier.de > -- Andrey