Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 99870 invoked from network); 19 Jul 2010 15:43:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Jul 2010 15:43:16 -0000 Received: (qmail 99550 invoked by uid 500); 19 Jul 2010 15:43:16 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 99435 invoked by uid 500); 19 Jul 2010 15:43:15 -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 99427 invoked by uid 99); 19 Jul 2010 15:43:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jul 2010 15:43:15 +0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jul 2010 15:43:08 +0000 Received: from jim.nabble.com ([192.168.236.80]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1OasUQ-0001pR-5a for users@openjpa.apache.org; Mon, 19 Jul 2010 08:42:46 -0700 Date: Mon, 19 Jul 2010 08:42:46 -0700 (PDT) From: Harald Wellmann To: users@openjpa.apache.org Message-ID: <1279554166162-5312588.post@n2.nabble.com> In-Reply-To: References: <72c1350f0912152022h2e1fd2caj2b6527200bfe2e7b@mail.gmail.com> <1279386261056-5306503.post@n2.nabble.com> Subject: Re: Override "jta-data-source" with system properties? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hmm, can you be a bit more specific about your "quick test"? How did you set your datasource properties then? Setting these two properties to "", I keep getting an exception regarding a non-existent transaction manager. Meanwhile, I've found a solution that works for me. persistence.xml: org.apache.openjpa.persistence.PersistenceProviderImpl jdbc/MyDataSource ... Test fixture set-up: Map props = new HashMap(); props.put("javax.persistence.jdbc.driver", driver); props.put("javax.persistence.jdbc.url", url); props.put("javax.persistence.jdbc.user", user); props.put("javax.persistence.jdbc.password", password); // Properties for the alternate non-jta-data-source. We need to set these // to override the jta-data-source in persistence.xml props.put("openjpa.Connection2DriverName", driver); props.put("openjpa.Connection2URL", url); props.put("openjpa.Connection2UserName", user); props.put("openjpa.Connection2Password", password); // create the schema props.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=false)"); EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit, props); em = emf.createEntityManager(); The trick is you have to set both the Connection* and the Connection2* properties. Don't ask me why, though... Tested with OpenJPA 2.0.0. Regards, Harald -- View this message in context: http://openjpa.208410.n2.nabble.com/Override-jta-data-source-with-system-properties-tp4173119p5312588.html Sent from the OpenJPA Users mailing list archive at Nabble.com.