You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Andy Schlaikjer (JIRA)" <ji...@apache.org> on 2008/01/25 19:31:40 UTC

[jira] Commented: (OPENJPA-78) Automatic runtime enhancement only works when the class is listed in the first persistence-unit

    [ https://issues.apache.org/jira/browse/OPENJPA-78?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562613#action_12562613 ] 

Andy Schlaikjer commented on OPENJPA-78:
----------------------------------------

I was curious about this-- I have separate persistence units in a single project and wasn't sure how to specify which persistence unit the forward mapping tool should operate on during build-time database initialization. This is when I figured out that the forward mapping tool (and I guess the underlying schema tool) only pay attention to the first persistence unit defined in META-INF/persistence.xml. Would be nice to document this behavior until an additional option is exposed allowing specification of persistence unit on which to operate.

> Automatic runtime enhancement only works when the class is listed in the first persistence-unit
> -----------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-78
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-78
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Marc Prud'hommeaux
>
> When multiple persistence-units are defined in the persistence.xml, only the first one is examined when looking for classes to enhance when using the automatic runtime enhancement (e.g., using the "-javaagent:openjpa.jar" argument). So if the project uses the following persistence.xml:
> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
>     <persistence-unit name="unit1" transaction-type="RESOURCE_LOCAL">
>         <class>unit1.SomeClass</class>
>     </persistence-unit>
>     <persistence-unit name="unit2" transaction-type="RESOURCE_LOCAL">
>         <class>unit2.SomeClass</class>
>     </persistence-unit>
> </persistence>
> In this example, when unit1.SomeClass is loaded, it will be enhanced, but unit2.SomeClass won't ever be enhanced.
> The only workaround is to list all of your persistent classes in an initial entry in the persistence-unit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.