Community
Participate
Working Groups
>In the following model we fail to properly find an attribute because we fail to do >secondary processing when the attribute is not inherited >reproduction (add a getMetamodel() to JavaSECMPInitializer.initPersistenceUnits():262 Do a getMetamodel during deploy of the following model descriptor RelationalDescriptor (id=346) alias "" (id=57) javaClass Class<T> (org.eclipse.persistence.testing.models.jpa.inherited.RatedBeerConsumer) (id=348) javaClassName "org.eclipse.persistence.testing.models.jpa.inherited.RatedBeerConsumer" (id=393) @MappedSuperclass @Access(FIELD) public abstract class RatedBeerConsumer<X, Y, Z> extends BeerConsumer<String> { @BasicCollection(valueColumn=@Column(name="ACCLAIM")) private Collection<X> acclaims; Testing Browser (JPA) [Java Application] org.eclipse.persistence.testing.framework.ui.TestingBrowserFrame at localhost:59678 Thread [main] (Suspended) MappedSuperclassTypeImpl<X>(ManagedTypeImpl<X>).initialize() line: 1182 MetamodelImpl.initialize() line: 434 MetamodelImpl.<init>(DatabaseSession) line: 109 MetamodelImpl.<init>(EntityManagerSetupImpl) line: 128 EntityManagerSetupImpl.getMetamodel() line: 2003 JavaSECMPInitializer.initPersistenceUnits(Archive, Map, PersistenceInitializationHelper) line: 262 JavaSECMPInitializer.initialize(Map) line: 216 JavaSECMPInitializer.initializeFromAgent(Instrumentation) line: 159 >stacktrace Caused by: java.lang.NullPointerException at org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl.initialize(ManagedTypeImpl.java:1182) at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.initialize(MetamodelImpl.java:434) at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.<init>(MetamodelImpl.java:109) at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.<init>(MetamodelImpl.java:128) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.getMetamodel(EntityManagerSetupImpl.java:2003) at org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:262) at org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:216) at org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer.initializeFromAgent(JavaSECMPInitializer.java:159) ... 12 more >cause ManagedTypeImpl.initialize():1182 fails to check for a null inheritingTypeMember before attempting to get a an attributeField from it >fix If the attribute is not found in the hierarchy above the current ManagedType using getMemberFromInheritingType() - then don't attempt to access the attribute field. Instead defer to later code that calls various field/property method calls directly on the current class (ManagedType) in getTypeClassFromAttributeOrMethodLevelAccessor()
>This will fix open design issue # 25 http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_25:_20090616:_Inherited_parameterized_generics_for_Element_Collections_.28Basic.29
>fix essentially was not to do reflection on inherited class when the method does not exist there - for collection mappings Testing Browser (JPA) [Java Application] org.eclipse.persistence.testing.framework.ui.TestingBrowserFrame at localhost:60335 Thread [main] (Suspended) MappedSuperclassTypeImpl<X>(ManagedTypeImpl<X>).getTypeClassFromAttributeOrMethodLevelAccessor(DatabaseMapping) line: 1365 MappedSuperclassTypeImpl<X>(ManagedTypeImpl<X>).initialize() line: 1195 MetamodelImpl.initialize() line: 434 MetamodelImpl.<init>(DatabaseSession) line: 109 MetamodelImpl.<init>(EntityManagerSetupImpl) line: 128 EntityManagerSetupImpl.getMetamodel() line: 2003 JavaSECMPInitializer.initPersistenceUnits(Archive, Map, PersistenceInitializationHelper) line: 262 JavaSECMPInitializer.initialize(Map) line: 216 >aField Field (id=153) clazz Class<T> (org.eclipse.persistence.testing.models.jpa.inherited.RatedBeerConsumer) (id=65) name "acclaims" (id=161) type Class<T> (java.util.Collection) (id=78) aType Class<T> (java.util.Collection) (id=78)
Created attachment 176173 [details] Collection attributes that are not inherited (exist on current type) that used to cause NPE on metamodel initialization now do reflection only on current class Collection attributes that are not inherited (exist on current type) that used to cause NPE on metamodel initialization now do reflection only on current class
>Reviewed by Guy P.
Created attachment 178560 [details] Collection attributes that are not inherited (exist on current type) that used to cause NPE on metamodel initialization now do reflection only on current class
>see SVN rev# 8158 for 2.2 https://fisheye2.atlassian.com/changelog/eclipselink/?cs=8158
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink