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/07/29 03:45:14 UTC

[jira] Created: (OPENJPA-1203) JPA2 - createEMF should return null for unhandled PUs

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: jpa
    Affects Versions: 2.0.0
            Reporter: Donald Woods
            Assignee: Donald Woods
            Priority: Minor


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.


[jira] Commented: (OPENJPA-1203) JPA2 - createEMF should return null for unhandled PUs

Posted by "Donald Woods (JIRA)" <ji...@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 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.


[jira] Resolved: (OPENJPA-1203) JPA2 - createEMF should return null for unhandled PUs

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods resolved OPENJPA-1203.
-----------------------------------

    Resolution: Fixed

mentioned in Migration section of docs using r822006

> 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.


[jira] Issue Comment Edited: (OPENJPA-1203) JPA2 - createEMF should return null for unhandled PUs

Posted by "Donald Woods (JIRA)" <ji...@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.


[jira] Commented: (OPENJPA-1203) JPA2 - createEMF should return null for unhandled PUs

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12736412#action_12736412 ] 

Donald Woods commented on OPENJPA-1203:
---------------------------------------

Also see discussion thread http://n2.nabble.com/JPA2---When-should-createEMF%28%29-return-an-Exception-vs.-NULL--tp3312130p3312130.html

> 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: jpa
>    Affects Versions: 2.0.0
>            Reporter: Donald Woods
>            Assignee: Donald Woods
>            Priority: Minor
>
> 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.


[jira] Updated: (OPENJPA-1203) JPA2 - createEMF should return null for unhandled PUs

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1203:
----------------------------------

      Component/s:     (was: jpa)
                   docs
    Fix Version/s: 2.0.0-M3

Doc this as an OpenJPA behavior...

> 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.