incorrect exception thrown for unenhanced class when 
openjpa.RuntimeUnenhancedClasses=unsupported 
--------------------------------------------------------------------------------------------------

                 Key: OPENJPA-914
                 URL: https://issues.apache.org/jira/browse/OPENJPA-914
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.2.0
         Environment: linux, java 1.6.0_12
            Reporter: Adam Hardy
            Priority: Minor


I accidentally failed to enhance an entity class at build-time. Except that 
one, all others were enhanced.

With openjpa.RuntimeUnenhancedClasses = unsupported I figured any problems with 
enhancement would throw the following at initialization time: 

org.apache.openjpa.persistence.ArgumentException: This configuration disallows 
runtime optimization, but the following listed types were not enhanced ....
        at 
org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:102)
        at 
org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:310)
        at 
org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)
        at 
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:190)
        at 
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
        at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
        at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
        at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
        at 
org.permacode.atomic.AtomicConfigurationBean.getEntityManagerFactory(AtomicConfigurationBean.java:190)

However initialization succeeded and instead the following exception was thrown 
later:

 org.apache.openjpa.persistence.ArgumentException: Errors encountered while 
resolving metadata.  See nested exceptions for details.
        at 
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:563)
        at 
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
        at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2426)
        at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2280)
        at 
org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1021)
        at 
org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:645)
        at 
org.permacode.patternrepo.jpa.JpaPortfolioDao.persist(JpaPortfolioDao.java:79)

I did a quick test and the main distinguishing feature of the classes that 
cause the wrong error message to be thrown are child classes of a mapped 
superclass. Simple classes without a superclass trigger the correct exception 
when not enhanced.


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

Reply via email to