openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manuel Meyer (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OPENJPA-2226) Automatic runtime enhancement only works when the class is listed in the first persistence-unit
Date Mon, 09 Jul 2012 13:18:33 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-2226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Manuel Meyer updated OPENJPA-2226:
----------------------------------

    Summary: Automatic runtime enhancement only works when the class is listed in the first
persistence-unit  (was: CLONE - PCEnhancer not processing multiple PU's defined within a single
persistence.xml file)
    
> Automatic runtime enhancement only works when the class is listed in the first persistence-unit
> -----------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2226
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2226
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.0.1, 2.2.0
>            Reporter: Manuel Meyer
>
> 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.OtherClass</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 exception we get is following:
> Exception in thread "main" <openjpa-2.2.0-r422266:1244990 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query
filter "select t from OtherClass t". Error message: The name "OtherClass" is not a recognized
entity or identifier. Perhaps you meant SomeClass, which is a close match. Known entity names:
[SomeClass]
> 	at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:119)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:194)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:167)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:242)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:212)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:205)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$200(JPQLExpressionBuilder.java:80)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:2417)
> 	at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:61)
> 	at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:162)
> 	at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:673)
> 	at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:654)
> 	at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:620)
> 	at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:682)
> 	at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:589)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:997)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:979)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:102)
> 	at de.meyerwerft.providertest.backend.BackendZugriff.leseMitPU2(BackendZugriff.java:60)
> 	at TesterMain.main(TesterMain.java:16)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message