You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Patrick Linskey (JIRA)" <ji...@apache.org> on 2007/08/09 16:45:43 UTC

[jira] Commented: (OPENJPA-72) PersistenceProviderImpl.createContainerEntityManagerFactory() should not add a ClassTransformerImpl to PersistenceUnitInfo if

    [ https://issues.apache.org/jira/browse/OPENJPA-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518729 ] 

Patrick Linskey commented on OPENJPA-72:
----------------------------------------

This is at least partially fixed. OpenJPA now consumes Spring's exception and logs a warning.

> PersistenceProviderImpl.createContainerEntityManagerFactory() should not add a ClassTransformerImpl to PersistenceUnitInfo if <exclude-unlisted-classes>
> --------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-72
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-72
>             Project: OpenJPA
>          Issue Type: Bug
>         Environment: JDK1.5, Win32, openjpa-0.9.0-incubating
>            Reporter: Corey Klaasmeyer
>             Fix For: 1.1.0
>
>
> Adding a transformer is unnecessary if classes are enhanced at build time. As far as I can tell, you specify this by adding the <exclude-unlisted-classes> property to persistence.xml. This could probably be made more clear by calling the property something like "build-time-enhancement-only" or "disable-runtime-enhancement". Additionally, this causes a Spring configured JPA to fail with and IllegalStateException if no LoadTimeWeaver is specified in the LocalContainerEntityManagerFactory. The relevent code is on line 93 of PersistenceProviderImpl
>     public EntityManagerFactory createContainerEntityManagerFactory(
>         PersistenceUnitInfo pui, Map m) {
>         PersistenceProductDerivation pd = new PersistenceProductDerivation();
>         try {
>             ConfigurationProvider cp = pd.load(pui, m);
>             if (cp == null)
>                 return null;
>             // add enhancer
>             String ctOpts = (String) Configurations.getProperty
>                 (CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
>             pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, 
>                 pui.getNewTempClassLoader()));
>             BrokerFactory factory = Bootstrap.newBrokerFactory(cp, 
>                 pui.getClassLoader());
>             return OpenJPAPersistence.toEntityManagerFactory(factory);
>         } catch (Exception e) {
>             throw PersistenceExceptions.toPersistenceException(e);
>         }
>     }

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