Hi Andrus, thanks, that helped already. But one more question. I use the CayenneFilter which uses WebUtil to put my ServerRuntime. If I want to get it again, I use that bunch of code (this refers to Struts 2 Action ServletContextAware).
CayenneRuntime cayenneRuntime = WebUtil.getCayenneRuntime(this.getServletContext()); ServerRuntime serverRuntime = ((ServerRuntime)cayenneRuntime); serverRuntime.getDataDomain(); I was just surprise that getDataDomain() is not in CayenneRuntime. It seemed to me that would be the logical place. I can see getChannel and getContext is in CayenneRuntime too. So, why not getDataDomain? Cheers, Christian On Mon, Jul 25, 2011 at 4:54 PM, Andrus Adamchik <[email protected]> wrote: > Hi Christian, > > the approach is essentially the same (until we switch transaction factory to > DI that is) - you need a hold of DataDomain instance, and use it to create > transactions. In 3.1 You'd get DataDomain from ServerRuntime: > > ServerRuntime r = ... > DataDomain d = r.getDataDomain(); > > Of course how you get a hold of ServerRuntime is application-specific. > > Cheers, > Andrus > > On Jul 25, 2011, at 5:50 PM, Christian Grobmeier wrote: > >> Hi >> >> what is the correct approach here? >> http://cayenne.apache.org/doc/understanding-transactions.html >> >> DataDomain domain = Configuration.getSharedConfiguration().getDomain(); >> Transaction tx = domain.createTransaction(); >> >> The Configuration class is not in my jar anymore (3.1M2) so I guess it >> has changed recently >> >> Cheers, >> Christian >> > > -- http://www.grobmeier.de
