Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 72368 invoked from network); 6 Apr 2007 13:14:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Apr 2007 13:14:40 -0000 Received: (qmail 78296 invoked by uid 500); 6 Apr 2007 13:14:47 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 78165 invoked by uid 500); 6 Apr 2007 13:14:46 -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 78156 invoked by uid 99); 6 Apr 2007 13:14:46 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2007 06:14:46 -0700 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 r1.corporation@gmail.com designates 64.233.184.237 as permitted sender) Received: from [64.233.184.237] (HELO wr-out-0506.google.com) (64.233.184.237) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2007 06:14:39 -0700 Received: by wr-out-0506.google.com with SMTP id 67so596982wri for ; Fri, 06 Apr 2007 06:14:18 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=glkt4bqBZ7Jo3tHcihJlP0yHV4wd2cNFOu+PeeYMsOTSFTxYrMoy+mi/ZWNfQqrkSgHyMOAg64euC5814g96lwite1HBPpYb4RpY95+sdg2DA43M8QCH8KZvo9yX4NM+x7ma4EQNc9imjWXPRIc33m4CcKhgyNZEwem38fDiwMQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=BTaqkKG2zNw9e9u5C5o6NE5TrZiYjRmWz+334GR2fVPN2bY6XxZdkBgpaJ8gv0106vU6bxQ4d+FsaTQ0Ll83FEOsy4nWeMjO7OqTUuwoZsV/9RqOpuJDSmljQkt8X6W/JI2jvi+dzqYNA16k/HN+VeRsksLc0pzvNUSYM7d601I= Received: by 10.115.78.1 with SMTP id f1mr1234598wal.1175865257715; Fri, 06 Apr 2007 06:14:17 -0700 (PDT) Received: by 10.114.79.19 with HTTP; Fri, 6 Apr 2007 06:14:17 -0700 (PDT) Message-ID: <2abb614a0704060614p30280cb5xa3471ecf036358b5@mail.gmail.com> Date: Fri, 6 Apr 2007 15:14:17 +0200 From: "r1 Corporation" To: open-jpa-dev@incubator.apache.org Subject: Programmatical EntityManagerFactory init MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3604_22878996.1175865257674" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_3604_22878996.1175865257674 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Messieurs-dames, As I could not find much clues about the right way to do it, here I come: I'm trying to get an EntityManagerFactory properly setup from the Persistence class, but I cannot get further than the following exception javax.persistence.PersistenceException: No Persistence provider for EntityManager named teamplay_test at javax.persistence.Persistence.createEntityManagerFactory( Persistence.java:89) at com.gdteam.teamplay.domain.manager.TeamplayEMFactoryManager.get ( TeamplayEMFactoryManager.java:60) at com.gdteam.teamplay.test.persistence.PersistenceUtilTest.setUp( PersistenceUtilTest.java:19) at junit.framework.TestCase.runBare(TestCase.java:125) at junit.framework.TestResult$1.protect (TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) Here is the code part that leads to the exception: public class TeamplayEMFactoryManager { ... private final Map props = new HashMap(); private final Map map = new HashMap(); ... private TeamplayEMFactoryManager() { props.put("openjpa.ConnectionDriverName", "org.hsqldb.jdbcDriver"); props.put("openjpa.ConnectionUserName", "sa"); props.put("openjpa.ConnectionPassword", ""); props.put("openjpa.Log", "DefaultLevel=WARN, Tool=INFO"); props.put("openjpa.MetaDataFactory", "jpa(Types="+buildTypes()+")"); } .. public EntityManagerFactory get(String url) { EntityManagerFactory factory = null; if (null == url || url.length() == 0 ) { url = "default"; } factory = this.map.get(url); if (null == factory) { if ( "default".equals(url)) { 1- factory = Persistence.createEntityManagerFactory(null); } else { Map map = new HashMap(props); map.put("openjpa.ConnectionURL ", buildUrl(url)); 2- factory = Persistence.createEntityManagerFactory(url,map); } this.map.put(url, factory); } return factory; } ... } Note : I'm using a persistence.xml for single persitence unit creation, and this test works fine. I've had a dive into the source code, and found the provider is lookuped and found by the glassfish persistence implementation class. The exception is raised on the open jpa side, and I know I'm missing some configuration elements, but I cannot guess what's missing? any hint? thank you guys ------=_Part_3604_22878996.1175865257674--