You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Donald Woods (JIRA)" <ji...@apache.org> on 2009/10/05 22:59:31 UTC
[jira] Commented: (OPENJPA-1203) JPA2 - createEMF should return
null for unhandled PUs
[ https://issues.apache.org/jira/browse/OPENJPA-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12762365#action_12762365 ]
Donald Woods commented on OPENJPA-1203:
---------------------------------------
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.