Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 95923 invoked from network); 8 Mar 2011 12:12:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Mar 2011 12:12:17 -0000 Received: (qmail 29446 invoked by uid 500); 8 Mar 2011 12:12:16 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 29427 invoked by uid 500); 8 Mar 2011 12:12:16 -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 29419 invoked by uid 99); 8 Mar 2011 12:12:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 12:12:16 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [209.191.69.70] (HELO web30308.mail.mud.yahoo.com) (209.191.69.70) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 08 Mar 2011 12:12:09 +0000 Received: (qmail 21405 invoked by uid 60001); 8 Mar 2011 12:11:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1299586307; bh=ypaZomhlCHC/6vtd9WTuTZH12uwnIZaulC5boumOKZg=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=QhCKZv8i8EWurBeLoLTTe+f6bAV9UA1k/LbF+2BqzGBXb8hRkKCxz8YUWYoXeCu17LPZjVkFquIRNAPDyH1vpk8njRFjRj728bU742ZDP9JkTuBpjFgy3RA1gGUzwP/T2P8nXUpNvjZIG+N9hVa+vBXEBcUh8HDd2hKg+/yTibg= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=OvW15EAF24e8tjY0j3UqYJ8SlQJ+496VVj0CS5UtKIenOiM5kqeoXuupmlsblnsuzgfD+cD3/dp01Ll/GBtbpJkndA61VRoM3f/QKChFNJkTYvpKKKv5axNU1Z8T9LG7xSUAJ7B6ZFCr3Yiu041FweKgF2Dsm0gFjfrjmGgo6JM=; Message-ID: <220116.21397.qm@web30308.mail.mud.yahoo.com> X-YMail-OSG: 4nteFDIVM1kHy2yGO7mE8oBWZIN.XmkYIWd.YwmkBCX2UkG LPIk0JTPq6cBiWJRxlqZYNlpQtZqnrk0HmsIIalz.4_rxSGREJHFS19mnEiZ AE7GPWBxOCz1kjYte.g1vnuyn10NZGvWbPFMbgv8yPb7C3CDiDg49.ESngQI IiubMDFVr7foW4gbuY8o0ShGq_6dyQuo.ZxOxcuGAGZMXYWhCglR_2NrAWf4 wu.L5y0G5SAfUOiVQZEGNPCZmiUaI5.UUj1PdfmV3C59SiHU29hddffjIHB. MelFlz7s5cDGBY8T1rsA_uybbaF_FtVtdr30qXjfP_lV84LfOMVo6wieMP0K eTA-- Received: from [95.0.156.2] by web30308.mail.mud.yahoo.com via HTTP; Tue, 08 Mar 2011 04:11:47 PST X-Mailer: YahooMailWebService/0.8.109.292656 Date: Tue, 8 Mar 2011 04:11:47 -0800 (PST) From: Erdinc Reply-To: Erdinc Subject: Re: DI example To: "user@cayenne.apache.org" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1244055158-1299586307=:21397" X-Virus-Checked: Checked by ClamAV on apache.org --0-1244055158-1299586307=:21397 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable I didn't have clear understanding of what runtime or module is. Thank you f= or your reply.=0A=0A=0AFrom: Andrus Adamchik =0ATo:= user@cayenne.apache.org=0ASent: Tuesday, March 8, 2011 1:30 PM=0ASubject: = Re: DI example=0A=0A=0AOn Mar 8, 2011, at 1:13 PM, Erdinc wrote:=0A> You me= an in order to use DI you should add a custom runtime class extending Cayen= neRuntime. =0A=0ANo. Quite the contrary. There shouldn't be a need to exten= d CayenneRuntime (or ServerRuntime for that matter). If you need to add new= "services" or override the existing ones, you write a custom module and pa= ss it over to the runtime constructor. So extending Cayenne DI container is= trivial:=0A=0Aclass MyModule implements Module {=0A=A0 public void configu= re(Binder binder) { }=0A}=0A=0AServerRuntime r =3D new ServerRuntime("xyz-c= ayenne.xml", new MyModule());=0A=0A> I want to inject beans into the cayenn= e entity beans. In order to do this, I added a listener class;=0A=0AOk I se= e, Cayenne DI itself is not intended for that. I mean, you can use it for D= ataObject injection, but this was not why we added it. So yeah, if you want= to inject "services" in your objects, use lifecycle callbacks. As a matter= of fact 3.1M2 will help you a lot to implement that. I am now writing a re= lease announcement with some of this highlighted. But please take a look at= this page:=0A=0Ahttp://cayenne.apache.org/doc/guide-to-31-features.html#Gu= ideto3.1Features-LifecycleExtensions =0A=0ADataChannelFilter combined with = @PostLoad/@PostAdd and a custom entity annotation should help you with this= . And maybe someday we'll add DataObject injection into cayenne-lifecycle e= xtensions module.=0A=0AAndrus=0A=0A=0A --0-1244055158-1299586307=:21397--