Hi Andrus, I have checked out cayenne from the svn and the org.apache.cayenne.CayenneRuntimeException is missing.... Is this on purpose?
Regards Bruno On Fri, Feb 24, 2012 at 7:16 AM, Andrus Adamchik <[email protected]>wrote: > There was indeed a change between 3.1M3 and trunk (what will become M4 at > some point) introduced by John: > > > http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/DataContextFactory.java?r1=1196716&r2=1196715&pathrev=1196716 > > But either way, it is customizable. > > Cheers, > Andrus > > > On Feb 24, 2012, at 2:03 AM, 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 <[email protected]> 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 <[email protected] > >>> 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 | [email protected] | 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 > > > -- Bruno René Santos | [email protected] | 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
