Return-Path: X-Original-To: apmail-openjpa-users-archive@minotaur.apache.org Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 768C7FA60 for ; Tue, 30 Apr 2013 13:27:04 +0000 (UTC) Received: (qmail 91631 invoked by uid 500); 30 Apr 2013 13:27:04 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 91269 invoked by uid 500); 30 Apr 2013 13:27:00 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 91222 invoked by uid 99); 30 Apr 2013 13:26:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Apr 2013 13:26:58 +0000 X-ASF-Spam-Status: No, hits=2.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of curtisr7@gmail.com designates 209.85.219.43 as permitted sender) Received: from [209.85.219.43] (HELO mail-oa0-f43.google.com) (209.85.219.43) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Apr 2013 13:26:48 +0000 Received: by mail-oa0-f43.google.com with SMTP id k7so479018oag.2 for ; Tue, 30 Apr 2013 06:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=/nHIQHVDHL2xKj/rdo5ibDhwsLmVVgWSze2DzzcOGO4=; b=F1imx82RtJbf318KYcuFIEFklVMDqqHvZC+h7f2h+EYz3DAjq/s1AF4VolsC7tCTX2 75SbhvfgqsEEMvW1kzTMxCsb52iZGwGnjWjdRjMRrbHnPCrxfyUAT5r3ilHQHzR5RH3C xQci8au7XC20RiQIptAXm+AnfVCFBYRh6MKCkj/ZVSN8JBKhZC9Q33ZMbK+qPBDOR2pj +1tXdeTH+fSrOz0dmaUVF5d9bkEhRGvDbpUVz4xZiedR/B8F8POyOmI+mXtLeq5kr4r3 uDZkMEqqvzr2AqgpgN+EuRuF5YRAWE/GsC2xiXSAdc1wHin0Cyl4srqdo8+E4f5WWtCE VLgA== MIME-Version: 1.0 X-Received: by 10.60.79.131 with SMTP id j3mr6657643oex.71.1367328387617; Tue, 30 Apr 2013 06:26:27 -0700 (PDT) Received: by 10.60.23.36 with HTTP; Tue, 30 Apr 2013 06:26:27 -0700 (PDT) In-Reply-To: References: Date: Tue, 30 Apr 2013 08:26:27 -0500 Message-ID: Subject: Re: Is it possible to override the default openjpa persistence provider From: Rick Curtis To: users Content-Type: multipart/alternative; boundary=047d7b678126d5db5f04db93f2b3 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b678126d5db5f04db93f2b3 Content-Type: text/plain; charset=ISO-8859-1 Is there a compelling reason that you're trying to extend OpenJPA? What container are you running in? The reason I ask is that I see that org.apache .openjpa.osgi.OSGiPersistenceProviderImpl is a valid provider. If you are running in an OSGI environment, that will complicate things. On Tue, Apr 30, 2013 at 1:00 AM, Subash Chaturanga wrote: > Any idea on this please ? Please find my question posted in SO [1] . This > is regarding openjpa 2.2.0. And I think a custom provider class recognizes > as unknown. > > Here is the code I found, this method evaluates to false for a custom > provider class as for example public class MyProviderImpl implements > PersistenceProvider, ProviderUtil > > > private static boolean > *isOpenJPAPersistenceProvider*(PersistenceUnitInfo > pinfo, ClassLoader loader) { > String provider = pinfo.getPersistenceProviderClassName(); > if (StringUtils.isEmpty(provider) || > PersistenceProviderImpl.class.getName().equals(provider)) > return true; > > if (loader == null) > loader = > > AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction()); > try { > if > (PersistenceProviderImpl.class.isAssignableFrom(Class.forName(provider, > false, loader))) > return true; > } catch (Throwable t) { > log(_loc.get("unloadable-provider", provider, t).getMessage()); > return false; > } > return false; > } > > > [1]- > > http://stackoverflow.com/questions/16293136/openjpa-2-2-0-cannot-add-a-custom-persistence-provider-class-openjpa-recogniz > > On Mon, Apr 29, 2013 at 11:18 PM, Subash Chaturanga >wrote: > > > Hi > > I wrote a MyProvider > > extends org.apache.openjpa.persistence.PersistenceProviderImpl. And added > > MyProvider as the provider in the persistence.xml. > > Why I did this was to override the EntityManager.persist() method. But > > seems still the default provider class get picked up. Am i missing > > something ? > > > > -- > > Subash Chaturanga > > Sri Lanka > > > > Blog - http://subashsdm.blogspot.com/ > > Twitter - http://twitter.com/subash89 > > > > > > > > -- > Subash Chaturanga > Department of Computer Science & Engineering > University of Moratuwa > Sri Lanka > > Blog - http://subashsdm.blogspot.com/ > Twitter - http://twitter.com/subash89 > -- *Rick Curtis* --047d7b678126d5db5f04db93f2b3--