> I can see using Inject being messy in my Tapestry 5 applications as I > have to start using the full path to the Inject annotation every time > since T5 provides an Inject annotation, too
@Inject is for internal use within Cayenne and for writing Cayenne extensions. Unlike Tapestry we won't be forcing our DI engine for the entire application. > It appears you can no longer create a DataContext. I finally found > the Inject annotation and tried it, but I get a null pointer exception > because things aren't bootstrapped. Is there a simple way to do this > now that I'm missing? (I'm still looking through the code.) Unfortunately I haven't documented everything yet, but you can still find some examples and rudimentary docs in the upgrade notes: http://svn.apache.org/repos/asf/cayenne/main/trunk/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java http://svn.apache.org/repos/asf/cayenne/main/trunk/docs/doc/src/main/resources/UPGRADE.txt Specifically the bootstrap code now looks like this (taken from tutorial) : ServerRuntime cayenneRuntime = new ServerRuntime("cayenne-UntitledDomain.xml"); ObjectContext context = cayenneRuntime.getContext(); Not really harder than it was, except that there's no singleton, so you need to decide how to store/access ServerRuntime instance (e.g. inside Tapestry DI engine). Andrus On Sep 25, 2010, at 7:33 PM, Michael Gentry wrote: > I made a few tweaks to the H2 adapter in 3.1 and was wanting to test > them, so I started creating a simple class/project to test it. > Nothing complex, just insert a few records in a trivial table. > > It appears you can no longer create a DataContext. I finally found > the Inject annotation and tried it, but I get a null pointer exception > because things aren't bootstrapped. Is there a simple way to do this > now that I'm missing? (I'm still looking through the code.) > > Two other comments: > > I can see using Inject being messy in my Tapestry 5 applications as I > have to start using the full path to the Inject annotation every time > since T5 provides an Inject annotation, too. > > It also appears you can't Inject inside a method, either: > > public void updateFoo() > { > @Inject ObjectContext context; > ... > } > > There are many times in my current codebase (3.0) that I create a > local context. Is that feature going to be lost now? > > Thanks, > > mrg >