Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 44235 invoked from network); 5 Oct 2009 21:01:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Oct 2009 21:01:59 -0000 Received: (qmail 25469 invoked by uid 500); 5 Oct 2009 21:01:58 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 25435 invoked by uid 500); 5 Oct 2009 21:01:58 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 25394 invoked by uid 99); 5 Oct 2009 21:01:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Oct 2009 21:01:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Oct 2009 21:01:55 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 81523234C1EC for ; Mon, 5 Oct 2009 14:01:31 -0700 (PDT) Message-ID: <1398506818.1254776491528.JavaMail.jira@brutus> Date: Mon, 5 Oct 2009 14:01:31 -0700 (PDT) From: "Donald Woods (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Issue Comment Edited: (OPENJPA-1203) JPA2 - createEMF should return null for unhandled PUs In-Reply-To: <471511092.1248831914805.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12762365#action_12762365 ] Donald Woods edited comment on OPENJPA-1203 at 10/5/09 2:00 PM: ---------------------------------------------------------------- View r820390 of the geronimo-jpa_2.0_spec code for the implemented createEMF() behavior for handling exceptions - http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java?view=markup&pathrev=820390 Basically, even if a provider returns an exception, we'll still give any other provider on the classpath a chance, as required by the JPA 2.0 spec. If one exception is returned and no provider can return a EMF, then that exception is returned as the cause within a PersistenceException, so apps can use getCause() to determine the provider returned failure. If more than one exception is returned and no provider can return a EMF, then the exceptions are added to the end of the PersistenceException message and no cause will be set. Even if one or more providers return an exception, if a provider does return a EMF, then all exceptions will be discarded and the EMF will be returned to the caller. If no exceptions occur and no EMF can be returned, then a PersistenceException will be thrown with a generic message and list of providers discovered. was (Author: drwoods): View r820390 of the geronimo-jpa_2.0_spec code for the implemented createEMF() behavior for handling exceptions - http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java?view=markup&pathrev=820390 Basically, even if a provider returns an exception, we'll still give any other provider on the classpath a chance,a s required by the spec. If one exception is returned and no provider can return a EMF, then that exception is returned as a caused within a PersistenceException, so apps can use getCause() to determine the provider returned failure. If more than one exception is returned and no provider can return a EMF, then the exceptions are added to the end of the PersistenceException message and no cause will be set. Even if one or more providers return an exception, if a provider does return a EMF, then all exceptions will be discarded and the EMF will be returned to the caller. If no exceptions occur and no EMF can be returned, then a PersistenceException will be thrown. > JPA2 - createEMF should return null for unhandled PUs > ----------------------------------------------------- > > Key: OPENJPA-1203 > URL: https://issues.apache.org/jira/browse/OPENJPA-1203 > Project: OpenJPA > Issue Type: Bug > Components: docs > Affects Versions: 2.0.0 > Reporter: Donald Woods > Assignee: Donald Woods > Priority: Minor > Fix For: 2.0.0-M3 > > > JPA2 spec section 9.2 states - "If a provider does not qualify as the provider for the named persistence unit, it must return null when createEntityManagerFactory is invoked on it." > But OpenJPA is throwing exceptions for all failure cases... > For now, we'll keep the 1.x behavior, but may need to revisit this when we start running the JPA2 TCK. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.