Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 71935 invoked from network); 3 Jan 2007 22:28:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jan 2007 22:28:51 -0000 Received: (qmail 73156 invoked by uid 500); 3 Jan 2007 22:28:57 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 73111 invoked by uid 500); 3 Jan 2007 22:28:57 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 73102 invoked by uid 99); 3 Jan 2007 22:28:57 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jan 2007 14:28:57 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of matthieu.riou@gmail.com designates 64.233.182.185 as permitted sender) Received: from [64.233.182.185] (HELO nf-out-0910.google.com) (64.233.182.185) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jan 2007 14:28:47 -0800 Received: by nf-out-0910.google.com with SMTP id a4so7662238nfc for ; Wed, 03 Jan 2007 14:28:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=OJTdE0JeZ5iDbRJXEctxk0aRxfAHYHq1otP3DeXpuOwoLsKYobaqTtGip1eFCPIPulMHachCzWuEpVtqGF6i97iCMrQ+skNNxW8vOhN7V2FK31sWentc8/S29lM0p6dQyXQvyODHqlMlv2btOPCjuIZd6QuQlURsk+4tqM8xqJQ= Received: by 10.48.240.10 with SMTP id n10mr11457319nfh.1167863306634; Wed, 03 Jan 2007 14:28:26 -0800 (PST) Received: by 10.49.60.20 with HTTP; Wed, 3 Jan 2007 14:28:21 -0800 (PST) Message-ID: Date: Wed, 3 Jan 2007 14:28:21 -0800 From: "Matthieu Riou" Reply-To: matthieu.riou@gmail.com To: open-jpa-dev@incubator.apache.org Subject: Re: Configuration: either / or ? In-Reply-To: <951C2A8B-A313-4C24-9040-2107B3D21538@apache.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3522_7934207.1167863301568" References: <8B05B93F-68BF-4400-AC7B-2701E48C7B70@bea.com> <951C2A8B-A313-4C24-9040-2107B3D21538@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_3522_7934207.1167863301568 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline My ultimate goal is to provide directly an instance of DataSource that OpenJPA would use instead of trying to lookup or create one. It seems that it's possible by setting ConnectionFactory to the datasource instance but OpenJPA fails before that if no ConnectionDriverName is specified. Abe is right when saying that I should provide the properties to createEntityManager insteand of createEntityManagerFactory but I still can't find to way to initialize everything property. Thanks, Matthieu On 1/3/07, Marc Prud'hommeaux wrote: > > Matthieu- > > Can you send the complete stack trace? > > Also, I don't think this is the cause of the problem, but why are you > specifying both ConnectionDriverName and ConnectionFactory? With > ConnectionFactory specified, you shouldn't need to specify the > ConnectionDriverName. > > > > On Jan 3, 2007, at 5:01 PM, Matthieu Riou wrote: > > > Sorry I've jumped too quickly to conclusions. The mistake was mine. > > > > However I'm trying to initialize OpenJPA programmatically using the > > following code: > > > > HashMap propMap = new HashMap(); > > propMap.put("openjpa.ManagedRuntime", new TxMgrProvider > > (_txMgr)); > > propMap.put("openjpa.ConnectionDriverName", > > org.apache.derby.jdbc.EmbeddedDriver.class.getName()); > > propMap.put("openjpa.ConnectionFactory", _datasource); > > EntityManagerFactory emf = > > Persistence.createEntityManagerFactory("ode-dao", > > propMap); > > EntityManager em = emf.createEntityManager(propMap); > > > > The TxMgrProvider implements the ManagedRuntime interface. > > > > When execute, for each of the Map key I'm passing I'm getting: > > > > <4|false|0.9.6-incubating-SNAPSHOT> > > org.apache.openjpa.persistence.ArgumentException: Missing getter for > > property "ConnectionDriverName" in type "class > > org.apache.openjpa.persistence.EntityManagerImpl". > > > > With the NoSuchMethodException that comes together. As I'm passing > > configuration properties I don't get why it tries to set of get > > them on the > > entity manager. I guess I'm doing something wrong, do you have an > > idea of > > what could that be? > > > > Thanks! > > > > Matthieu > > > > On 1/3/07, Abe White wrote: > >> > >> > I've been fighting for some time now with my OpenJPA configuration > >> > and just > >> > discovered why. It seems that you *either* consider the > >> > persistence.xml file > >> > *or* the map passed as parameter of > >> > Persistence.createEntityManagerFactory. > >> > If you look at PersistenceProductDerivation.load(String rsrc, > >> > String name, > >> > Map m) (line 151), if the configuration provider can find a > >> > configuration > >> > file then the configuration is returned as is and the provided > >> > configuration > >> > Map doesn't even gets considered. > >> > >> I don't see this. The Map is passed along to the method that loads > >> the configuration file, which passes it along to the configuration > >> parser, which sets its entries over the properties it parses. > >> _____________________________________________________________________ > >> __ > >> Notice: This email message, together with any attachments, may > >> contain > >> information of BEA Systems, Inc., its subsidiaries and > >> affiliated > >> entities, that may be confidential, proprietary, copyrighted > >> and/or > >> legally privileged, and is intended solely for the use of the > >> individual > >> or entity named in this message. If you are not the intended > >> recipient, > >> and have received this message in error, please immediately return > >> this > >> by email and then delete it. > >> > > ------=_Part_3522_7934207.1167863301568--