There is in trunk.

On Thursday, February 23, 2012, Bruno René Santos wrote:

> Hi John,
>
>
> There is no newInstance() method to override on DataContextFactory... are
> you sure this is the right way?
>
> Regards
> Bruno
>
> On Thu, Feb 23, 2012 at 6:18 PM, John Huss <johnth...@gmail.com<javascript:;>>
> wrote:
>
> > First you need to subclass the factory:
> >
> > public class MyContextFactory extends DataContextFactory {
> >    @Override
> >    protected DataContext newInstance(DataChannel parent, ObjectStore
> > objectStore) {
> >    return new MyContext(parent, objectStore);
> >    }
> > }
> >
> > Then, create a custom Dependency Injector module:
> >
> > import org.apache.cayenne.configuration.ObjectContextFactory;
> > import org.apache.cayenne.di.Binder;
> > import org.apache.cayenne.di.Module;
> >
> > public class AppModule implements Module {
> > public void configure(Binder binder) {
> > binder.bind(ObjectContextFactory.class).toInstance(new
> MyContextFactory());
> > }
> > }
> >
> > Then reference your module when creating the CayenneRuntime:
> >
> >  ServerRuntime localRuntime = new
> > ServerRuntime("cayenne-MyDomain.xml", newAppModule());
> >
> > John
> > On Thu, Feb 23, 2012 at 11:28 AM, Bruno René Santos 
> > <brunor...@holos.pt<javascript:;>
> > >wrote:
> >
> > > Hello all,
> > >
> > > I am trying to migrate my web application from 3.0.1 to 3.1M3. My main
> > > problem now is that I usually use a custom DataContext in my Apps. In
> > 3.0.1
> > > I would use the DataContextFactory (defined on the modeler) to
> configure
> > > the use of the custom class. How do I do that on 3.1?
> > >
> > > Regards
> > > Bruno
> > >
> >
>
>
>
> --
> Bruno René Santos | brunor...@holos.pt <javascript:;> | Gestor de
> Projectos | Analista |
> Programador | Investigador
>
> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you are not the intended recipient or the person responsible for
> delivering the email to the intended recipient, be advised that you have
> received this email in error and that any use, dissemination, forwarding,
> printing, or copying of this email is strictly prohibited. If you have
> received this email in error please notify Bruno René Santos by telephone
> on +351 210 438 686
>

Reply via email to