openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Patel (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-524) NullPointerException when persisting a subclass and @Id field is declared in the abstract superclass.
Date Tue, 26 Feb 2008 18:24:51 GMT
NullPointerException when persisting a subclass and @Id field is declared in the abstract superclass.
-----------------------------------------------------------------------------------------------------

                 Key: OPENJPA-524
                 URL: https://issues.apache.org/jira/browse/OPENJPA-524
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 1.0.2
         Environment: Windows XP, JDK 1.5.0_14, Build time enhancement
            Reporter: Amit Patel
         Attachments: NPE.log, OpenJPATest.zip

When persisting a subclass that has a superclass with an @Id annotation in it, OpenJPA throws
the following NullPointerException:

Exception in thread "main" <openjpa-1.0.2-r420667:627158 fatal user error> org.apache.openjpa.persistence.ArgumentException:
Errors encountered while resolving metadata.  See nested exceptions for details.
        at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:522)
        at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:302)
        at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2372)
        at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2225)
        at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1005)
        at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541)
        at JpaTest.main(JpaTest.java:37)
Caused by: <openjpa-1.0.2-r420667:627158 fatal user error> org.apache.openjpa.persistence.ArgumentException:
Attempt to map "Person.id" failed: the owning entity is not mapped.
        at org.apache.openjpa.jdbc.meta.MappingInfo.assertTable(MappingInfo.java:544)
        at org.apache.openjpa.jdbc.meta.MappingInfo.createColumns(MappingInfo.java:496)
        at org.apache.openjpa.jdbc.meta.ValueMappingInfo.getColumns(ValueMappingInfo.java:143)
        at org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy.map(PrimitiveFieldStrategy.java:83)
        at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
        at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
        at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
        at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
        at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:841)
        at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:322)
        at org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:621)
        at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:508)
        ... 6 more
NestedThrowables:
java.lang.NullPointerException
        at org.apache.openjpa.jdbc.meta.MappingInfo.mergeJoinColumn(MappingInfo.java:1386)
        at org.apache.openjpa.jdbc.meta.MappingInfo.createJoins(MappingInfo.java:1192)
        at org.apache.openjpa.jdbc.meta.MappingInfo.createForeignKey(MappingInfo.java:954)
        at org.apache.openjpa.jdbc.meta.ValueMappingInfo.getTypeJoin(ValueMappingInfo.java:104)
        at org.apache.openjpa.jdbc.meta.strats.RelationToManyTableFieldStrategy.map(RelationToManyTableFieldStrategy.java:130)
        at org.apache.openjpa.jdbc.meta.strats.RelationCollectionTableFieldStrategy.map(RelationCollectionTableFieldStrategy.java:94)
        at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
        at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
        at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
        at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
        at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:812)
        at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1618)
        at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:675)
        at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:636)
        at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:514)
        at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:302)
        at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2372)
        at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2225)
        at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1005)
        at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541)
        at JpaTest.main(JpaTest.java:37)
<openjpa-1.0.2-r420667:627158 fatal user error> org.apache.openjpa.persistence.ArgumentException:
Attempt to map "Contact.acquireDate" failed: the owning entity is not mapped.
        at org.apache.openjpa.jdbc.meta.MappingInfo.assertTable(MappingInfo.java:544)
        at org.apache.openjpa.jdbc.meta.MappingInfo.createColumns(MappingInfo.java:496)
        at org.apache.openjpa.jdbc.meta.ValueMappingInfo.getColumns(ValueMappingInfo.java:143)
        at org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy.map(PrimitiveFieldStrategy.java:83)
        at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
        at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
        at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
        at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
        at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:851)
        at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:808)
        at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1618)
        at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:675)
        at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:636)
        at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:514)
        at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:302)
        at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2372)
        at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2225)
        at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1005)
        at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541)
        at JpaTest.main(JpaTest.java:37)

The attached test case can recreate this error.

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


Mime
View raw message