Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 39088 invoked from network); 4 Oct 2007 16:33:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Oct 2007 16:33:42 -0000 Received: (qmail 66355 invoked by uid 500); 4 Oct 2007 16:33:30 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 66346 invoked by uid 500); 4 Oct 2007 16:33:30 -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 66337 invoked by uid 99); 4 Oct 2007 16:33:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2007 09:33:30 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 04 Oct 2007 16:33:30 +0000 Received: (qmail 9171 invoked from network); 4 Oct 2007 16:33:10 -0000 Received: from unknown (HELO ??????h?IPv6:::1?) (127.0.0.1) by localhost with SMTP; 4 Oct 2007 16:33:10 -0000 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <53F71FBF-0081-40AD-A4FF-2D9483FA32D8@rodanotech.ch> References: <9cc55f600710040716xae1e5f1h55cb64541bd45ead@mail.gmail.com> <53F71FBF-0081-40AD-A4FF-2D9483FA32D8@rodanotech.ch> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable From: Andrus Adamchik Subject: Re: Best practices question Date: Thu, 4 Oct 2007 19:33:16 +0300 To: user@cayenne.apache.org X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org Been meaning to implement a runtime "multiple configs merge" =20 algorithm in Cayenne for some time. I think there may even be a Jira =20 for that somewhere. Conceptually this is a valuable addition as it =20 allows seamless modular packaging. As for the workaround that does not involve manual merging, I usually =20= create a separate mapping project with a single cayenne.xml that can =20 be imported in multiple applications. Inside that project I separate =20 logical "packages" by placing them in separate DataMaps. Andrus On Oct 4, 2007, at 6:24 PM, Eric BIANCHI wrote: > Hello Chris, > > We have the same configuration here. > > We put cayenne.xml in our/class/path/ in Package B. > > =46rom Package A, we load package B's cayenne.xml : > > DefaultConfiguration conf =3D new DefaultConfiguration(); > conf.addClassPath("our/class/path"); > Configuration.initializeSharedConfiguration(conf); > > Then we load package A's cayenne.xml > > DefaultConfiguration conf2 =3D new DefaultConfiguration(); > > And finally we merge the two datamaps : > > try { > conf2.initialize(); > Configuration.getSharedConfiguration().getDomain().addMap=20 > ((DataMap) conf2.getDomain().getDataMaps().iterator().next()); > Configuration.getSharedConfiguration().getDomain().addNode=20 > ((DataNode) conf2.getDomain().getDataNodes().iterator().next()); > } catch (Exception e) { > //beuh... > } > =09 > I hope it helps !! > > Best Regards > > Eric > > Le 4 oct. 07 =E0 16:16, Chris Gamache a =E9crit : > >> Here's the scenario... >> >> Project A uses cayenne >> Project B also uses cayenne >> >> They both have a cayenne.xml and nodes and domains, etc. >> >> Package A uses package B. I'm finding that when package A first >> initializes cayenne, subsequent initializations when classes from >> package B are instantiated ignore the cayenne.xml file from package B >> and it's underlying maps,nodes,domains, etc. causing some chaos. I =20= >> bet >> this is the expected behavior. I could merge and copy the cayenne.xml >> files so that all packages use the same file. I bet there's a better >> way, though. Perhaps even the /best/ (tm) way... >> >> Please advise! >> >> CG >> > > -- > Eric BIANCHI > --------------------------------------- > eric.bianchi@rodanotech.ch +41 (0)774 10 80 36 > http://www.rodanotech.ch Skype: erbianchi > > > >