Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 28ED69BA4 for ; Thu, 17 May 2012 13:54:46 +0000 (UTC) Received: (qmail 31689 invoked by uid 500); 17 May 2012 13:54:45 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 31655 invoked by uid 500); 17 May 2012 13:54:45 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 31647 invoked by uid 99); 17 May 2012 13:54:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 May 2012 13:54:45 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lukasz.budnik@gmail.com designates 209.85.213.45 as permitted sender) Received: from [209.85.213.45] (HELO mail-yw0-f45.google.com) (209.85.213.45) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 May 2012 13:54:39 +0000 Received: by yhoo21 with SMTP id o21so2199642yho.32 for ; Thu, 17 May 2012 06:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=7z2GBmW4s4htREjdOVHtMrYpMmXbPhTIo3B7quItsv0=; b=Zi9LT/0+r3ao+uQvx7tuD6RssXRjAGhv/b3d/FbsHMm7CFy7YbMoiTud2nLLhcbzxt h9wkZRJO4rM54dCJkm/lxRlu2HiwgJFf2ub6+inJ2jd5Nt4Y3HqYUFm4zeVo07w/hH0C 6B8ZwIeDimG1nZ0uyOFClyhp7bAVflKd0N5DNLfBhglDMEqZmMpPUjjsNL/6USANhGa9 l5NNWLAS+q7qGnOXebiMGoYZH9vNWeSfiTB5GZKWWyPOVox3dHWqJv9SRw2fgGeXJSCb FalMwOMcsFLijIVtmC60Pk7C5FmCVWeK87UqjmwF8FdEDpdkGuFcW8khBWf+jR+fmP6T lscA== Received: by 10.236.76.233 with SMTP id b69mr8222501yhe.52.1337262858948; Thu, 17 May 2012 06:54:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.75.71 with HTTP; Thu, 17 May 2012 06:53:57 -0700 (PDT) In-Reply-To: <1337083442824-5709965.post@n5.nabble.com> References: <1337083442824-5709965.post@n5.nabble.com> From: =?UTF-8?Q?=C5=81ukasz_Budnik?= Date: Thu, 17 May 2012 15:53:57 +0200 Message-ID: Subject: Re: 2 persistence units in Camel To: users@camel.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi there, Thanks for your reply. Of course I have it defined. Anyway, I found a way to solve it but it was so complicated that I actually ended up designing simple tracer instead of fully fledged tracing. To make multiple entity manager factories you have to use LocalContainerEntityManagerFactoryBean instead of LocalEntityManagerFactoryBean. The container factory allows you to define path to persistence.xml. It turned out that class loader was not able to load 2 files of the same name. Any way, Spring still wasn't able to understand unitName attribute, and without it it complained about 2 possible candidate beans for autowiring. To fix it, you have to use Spring's factory-bean and factory-methods and then inject entity managers manually. And this was a little bit too much for me. I have my simplified tracing in place. But any way, by looking and running the JPA tracer example - the feature is quite nice :) cheers, =C5=81ukasz On 15 May 2012 14:04, Babak Vahdat wrote: > Hi > > Looking at the stacktrace you've provided I suspect you did *not* name th= e > persistence unit as "qualitas-pu" inside your "persistence.xml". That's i= t > should be something like: > > =C2=A0 > =C2=A0 =C2=A0... > =C2=A0 =C2=A0 ... > > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0... > =C2=A0 =C2=A0 > > =C2=A0 > > Can you maybe show your "persistence.xml". And what's your JPA provider? > OpenJPA, EclipseLink or Hibernate-EntityManager? And could you maybe prov= ide > the complete stacktrace? > > Babak > > > -- > View this message in context: http://camel.465427.n5.nabble.com/2-persist= ence-units-in-Camel-tp5709844p5709965.html > Sent from the Camel - Users mailing list archive at Nabble.com.