Return-Path: Delivered-To: apmail-incubator-aries-user-archive@minotaur.apache.org Received: (qmail 16290 invoked from network); 17 Sep 2010 16:50:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Sep 2010 16:50:17 -0000 Received: (qmail 40026 invoked by uid 500); 17 Sep 2010 16:50:17 -0000 Delivered-To: apmail-incubator-aries-user-archive@incubator.apache.org Received: (qmail 39882 invoked by uid 500); 17 Sep 2010 16:50:16 -0000 Mailing-List: contact aries-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: aries-user@incubator.apache.org Delivered-To: mailing list aries-user@incubator.apache.org Received: (qmail 39874 invoked by uid 99); 17 Sep 2010 16:50:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Sep 2010 16:50:16 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of alasdair.nottingham@gmail.com designates 209.85.216.175 as permitted sender) Received: from [209.85.216.175] (HELO mail-qy0-f175.google.com) (209.85.216.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Sep 2010 16:50:10 +0000 Received: by qyk31 with SMTP id 31so1156161qyk.6 for ; Fri, 17 Sep 2010 09:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=gd8/9JuNioK5DdC+yTCPcHWOxkVwer7BPuF3NBXwYhM=; b=LmX3NaxaRBecOnDSzPIz+Wm4DHf2l5yNtHyQh2hnKGqMeOaxdRHgIRn7HCzIiq8UNH qQ9NU82PTyIVMKKRAwuNl+dETnhVa+EzoLhiJf/u9VnJv/sE3Dif2HmAf863pcfotW2m 5B9llM1YVFD3hFBVV8E7WB84Gu0Z/RRwqAX+Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=E+Y0dc1p3Fj05hNwT83KdpSPsQ4DXlgRLrvU21jbn2ykOqJZj/ey44eRPdm7o4cDbX 4vrA2QsNfOYJ2s7OgMIHo3Ut1ExWMNtrcZjQEPyxiSKbpUo+Ni4ILgCFLtuwBeV2y4BS 8C5a3JKIObVmQBPY/Xh0Jl1Up4z1Asqz4OwMY= MIME-Version: 1.0 Received: by 10.224.113.1 with SMTP id y1mr3455132qap.333.1284742188689; Fri, 17 Sep 2010 09:49:48 -0700 (PDT) Sender: alasdair.nottingham@gmail.com Received: by 10.229.44.12 with HTTP; Fri, 17 Sep 2010 09:49:48 -0700 (PDT) In-Reply-To: References: <70BB094864E0724F8B661A11291288201A1AB28BFF@multi-exchange.multi-m.local> <3AE7BD91-E197-4B3D-9F51-8583253FFDAC@apache.org> Date: Fri, 17 Sep 2010 09:49:48 -0700 X-Google-Sender-Auth: EFwp8blbvMK6wCAn6_liTeICsxw Message-ID: Subject: Re: OSGi JPA and JDBC Services From: Alasdair Nottingham To: aries-user@incubator.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi, you are right about the samples, it is on my todo list, but I haven't got to it yet. I've written some documentation as a result of your email. It isn't on our website yet, it needs to sync from the wiki, but you can view it here: https://cwiki.apache.org/confluence/display/ARIES/JNDIProject Alasdair On 17 September 2010 07:45, Bengt Rodehav wrote: > Thanks for the clarification Alasdair, > Are there any samples/examples of "osgi:" I can look at. Do I need to add= a > namespace in the persistent descriptor, deploy certain bundles etc? > Clearly, the way you describe it, "osgi:" must be preferred to "aries:". > Maybe the Aries samples should change to reflect that? > /Bengt > > 2010/9/17 Alasdair Nottingham >> >> aries:services is also a JNDI lookup scheme, it works much the same way = as >> osgi:service, but osgi:service returns a proxy to the target object whic= h >> switches out the target if it changes. aries:services does not proxy, yo= u >> get e raw object so it is a little bit less dynamic and safe. >> >> Alasdair Nottingham >> On 17 Sep 2010, at 03:10, Bengt Rodehav wrote: >> >> Have I misunderstood when I use "aries:" instead of "osgi:" or is it jus= t >> different prefixes to the same namespace? In the JPA samples I cannot se= e in >> the persistence descriptor what namespace "aries:" actually refers to. >> /Bengt >> >> 2010/9/17 Timothy Ward >>> >>> Hi Harald, >>> >>> The Aries project aims to provide a managed programming model, and as >>> such the Aries JPA runtime is not an implementation of the JPA service >>> specification. >>> >>> As a result I'm afraid my first answer is no, Aries JPA cannot be used = to >>> get unmanaged JPA support, however if you declare your persistence unit= s to >>> use RESOURCE_LOCAL transactions then there shouldn't be a need for Open= JPA >>> to load any JTA classes. Please let me know if OpenJPA continues to com= plain >>> about the lack of JTA interfaces for RESOURCE_LOCAL persistence units a= nd >>> I'll try to get that fixed. >>> >>> For your requirements you should need two bundles from the Aries JPA >>> project, the Aries JPA API bundle and the Aries JPA container bundle. Y= ou >>> will also need the Aries Util bundle, which the JPA project uses. >>> >>> For reference, the JPA container bundles provide the following support: >>> >>> jpa-api=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 :- Core interfaces us= ed by the Aries JPA runtime >>> and Service providers >>> jpa-container=A0=A0=A0=A0=A0=A0=A0=A0 :- The core JPA container, provid= es managed >>> EntityManager factories for use in Application-Managed JPA >>> jpa-container-context :- JPA managed persistence context support, allow= s >>> for bundles to be registered as clients of a managed persistence contex= t >>> jpa-blueprint-aries=A0=A0 :- Integration with the aries blueprint servi= ce >>> providing a custom namespace for JPA resource injection >>> >>> >>> The Aries JPA container is loosely coupled, so it is entirely possible = to >>> pick the bundles you need for the support you want, though each piece o= f >>> support builds upon the previous one, so it doesn't make much sense to = have >>> managed persistence context support without managed persistence unit >>> support. >>> >>> There's no need to use blueprint, Declarative Services is perfectly >>> capable of retrieving EntityManagerFactory services from the service >>> registry. >>> >>> How data sources are discovered depends upon how they are configured, i= f >>> you use the or tag, then the Ar= ies >>> JPA container will use JNDI to get the resource registered with that JN= DI >>> name. In most cases you actually want to access a DataSource object in = the >>> service registry, which means you need the Aries JNDI support (availabl= e as >>> a single bundle, or as separate core and URL handler bundles) which pro= vides >>> the osgi: namespace. >>> >>> If you want to specify database driver class names in the >>> section of the persistence unit then the JPA provider needs to be able = to >>> load those drivers. I do not know whether OpenJPA has support for the O= SGi >>> JDBC service specification, or whether they will simply try to load the >>> driver classes, and so this may not work. >>> >>> I hope this message has been helpful, and I agree that there is >>> insufficient documentation in this area. I would be more than happy for= any >>> Aries users to contribute information that they find useful so that bet= ter >>> documentation can be built. >>> >>> Regards, >>> >>> Tim >>> >>> ---------------------------------------- >>> > From: Harald.Wellmann@multi-m.de >>> > To: aries-user@incubator.apache.org >>> > Date: Thu, 16 Sep 2010 20:31:48 +0200 >>> > Subject: OSGi JPA and JDBC Services >>> > >>> > I'm currently trying to make OpenJPA 2.0.1 work in an OSGi environmen= t, >>> > and while looking for examples, I found a pointer to Apache Aries on = the >>> > OpenJPA Users' mailing list. >>> > >>> > So I had a look at the Aries website, checked out the latest code fro= m >>> > trunk, played around with it for a couple of hours and was left with = no >>> > usable result - it sort of feels like being offered a four course mea= l when >>> > all you were asking for was a plate of soup, and you don't even get a >>> > spoon... >>> > >>> > All I want to do is use OpenJPA in plain old unmanaged mode and have = it >>> > discover my persistence units and load classes from my application bu= ndles >>> > without DynamicImport-Package, buddy policies or fragments. I am curr= ently >>> > perfectly happy with Declarative Services and have no intention of >>> > converting my application to Blueprint. >>> > >>> > Can Aries be used to achieve just that? If so, what is the minimum se= t >>> > of Aries bundles I need to include in my application? >>> > >>> > I got as far as having my persistence unit discovered, but on creatin= g >>> > an EntityManagerFactory, OpenJPA always complained about missing JTA >>> > support. Does Aries implement unmanaged JPA at all? (It is supported = by the >>> > OSGi JPA spec, at any rate.) I can only see a call of >>> > PersistenceProvider.createContainerEntityManagerFactory() in Aries an= d no >>> > occurrence of createEntityManagerFactory(). On the OpenJPA side, ther= e is >>> > some code related to OSGi classloaders, but again, this is just used = for the >>> > managed factories and not for the unmanaged ones. >>> > >>> > Another question: how does the Persistence Provider discover the data >>> > source - where does the magic happen so that the lookup of >>> > osgi:service:/javax.sql.DataSource will work? Is that done by Aries a= lone, >>> > or does the persistence provider need to be OSGi aware in this respec= t? >>> > >>> > Thanks in advance for any hints! >>> > >>> > Best regards, >>> > Harald >>> > > --=20 Alasdair Nottingham not@apache.org