Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9030C90A8 for ; Fri, 24 Feb 2012 00:54:53 +0000 (UTC) Received: (qmail 73300 invoked by uid 500); 24 Feb 2012 00:54:53 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 73264 invoked by uid 500); 24 Feb 2012 00:54:53 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 73256 invoked by uid 99); 24 Feb 2012 00:54:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2012 00:54:53 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of johnthuss@gmail.com designates 209.85.216.50 as permitted sender) Received: from [209.85.216.50] (HELO mail-qw0-f50.google.com) (209.85.216.50) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2012 00:54:48 +0000 Received: by qabg27 with SMTP id g27so21026qab.16 for ; Thu, 23 Feb 2012 16:54:27 -0800 (PST) Received-SPF: pass (google.com: domain of johnthuss@gmail.com designates 10.229.77.69 as permitted sender) client-ip=10.229.77.69; Authentication-Results: mr.google.com; spf=pass (google.com: domain of johnthuss@gmail.com designates 10.229.77.69 as permitted sender) smtp.mail=johnthuss@gmail.com; dkim=pass header.i=johnthuss@gmail.com Received: from mr.google.com ([10.229.77.69]) by 10.229.77.69 with SMTP id f5mr108554qck.12.1330044867405 (num_hops = 1); Thu, 23 Feb 2012 16:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=cIH8cCqkND014Qqq4LYw6vxVdOgMcZ6NVyZ1Lt+tTO8=; b=vAxvWQMroP+TbJsDWN7PL126XdboP3s6TaHFz2X6GhkZM2KhtNpG2GYvRowEUv2mXU bgUjpst9uRRpMnUYYdbtxvZ3mKw4UX0LEoPL/auOzlljNGi+NQ8Yw/bNtim+Hses6+3D m43o4ibeQVKmI0B/45arxTjRsYCYk63utBhtk= MIME-Version: 1.0 Received: by 10.229.77.69 with SMTP id f5mr89890qck.12.1330044867237; Thu, 23 Feb 2012 16:54:27 -0800 (PST) Received: by 10.229.41.4 with HTTP; Thu, 23 Feb 2012 16:54:27 -0800 (PST) In-Reply-To: References: Date: Thu, 23 Feb 2012 18:54:27 -0600 Message-ID: Subject: Re: Migrating to cayenne 3.1 From: John Huss To: "user@cayenne.apache.org" Content-Type: multipart/alternative; boundary=002354471184d8d8b404b9ab333e --002354471184d8d8b404b9ab333e Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable There is in trunk. On Thursday, February 23, 2012, Bruno Ren=E9 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 > > 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 =3D new > > ServerRuntime("cayenne-MyDomain.xml", newAppModule()); > > > > John > > On Thu, Feb 23, 2012 at 11:28 AM, Bruno Ren=E9 Santos > > >wrote: > > > > > Hello all, > > > > > > I am trying to migrate my web application from 3.0.1 to 3.1M3. My mai= n > > > 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=E9 Santos | brunorene@holos.pt | Gestor de > Projectos | Analista | > Programador | Investigador > > Holos - Solu=E7=F5es Avan=E7adas em Tecnologias de Informa=E7=E3o S.A. > Parque de Ci=EAncia e Tecnologia de Almada/Set=FAbal . Edif=EDcio Madan P= arque > 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 intende= d > 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=E9 Santos by telepho= ne > on +351 210 438 686 > --002354471184d8d8b404b9ab333e--