Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322184

Summary: JPA2: Metamodel Entity1->MappedSuperClass->EntityRoot fails superType init because entities not processed before mappedSuperclasses - defer processing
Product: z_Archived Reporter: Michael OBrien <michael.f.obrien>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P2 CC: eclipselink.orm-inbox, michael.f.obrien, peter.krogh, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
URL: http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_42:_20090709:_IdentifiableType.supertype_-_what_do_top-level_types_set_it_to
Whiteboard:
Bug Depends on: 266912, 297928, 322166, 322585    
Bug Blocks: 303063    

Description Michael OBrien CLA 2010-08-09 16:16:25 EDT
>during Metamodel.initalize() we process MappedSuperclasses before entities
>however, in the case where a MappedSuperclass inherits from an Entity we will not have be able to set the superType on the mappedSuperclass

>reproduction
- get the metamodel early
>        initialize(); // here
>        ServerSession session = JUnitTestCase.getServerSession(PERSISTENCE_UNIT_NAME); // instead of here

aClass	Class<T> (org.eclipse.persistence.testing.models.jpa.metamodel.CoordinateMS) (id=187)	
potentialIdentifiableType	MappedSuperclassTypeImpl<X>  (id=188)	
MappedSuperclassTypeImpl@26281197:CoordinateMS [ javaType: class org.eclipse.persistence.testing.models.jpa.metamodel.CoordinateMS descriptor: RelationalDescriptor(org.eclipse.persistence.testing.models.jpa.metamodel.CoordinateMS --> [DatabaseTable(__METAMODEL_RESERVED_IN_MEM_ONLY_TABLE_NAME)]), mappings: 3]
superclass	Class<T> (org.eclipse.persistence.testing.models.jpa.metamodel.GalacticPosition) (id=189)	
identifiableTypeSuperclass	null	


this	MetamodelImpl  (id=63)	
	embeddables	LinkedHashMap<K,V>  (id=201)	
	entities	LinkedHashMap<K,V>  (id=203)	
		size	0	
	managedTypes	LinkedHashMap<K,V>  (id=204)	
		size	9	
		table	HashMap$Entry<K,V>[16]  (id=219)	
					key	Class<T> (org.eclipse.persistence.testing.models.jpa.metamodel.CoordinateMS) (id=187)	
	mappedSuperclasses	LinkedHashSet<E>  (id=205)	
		map	LinkedHashMap<K,V>  (id=259)	
			size	8	
	session	ServerSession  (id=159)	
	types	LinkedHashMap<K,V>  (id=209)	

Thread [Thread-3] (Suspended)	
	MetamodelImpl.initialize() line: 414	
	MetamodelImpl.<init>(DatabaseSession) line: 109	
	MetamodelImpl.<init>(EntityManagerSetupImpl) line: 128	
	EntityManagerSetupImpl.getMetamodel() line: 2003	
	EntityManagerFactoryImpl.getMetamodel() line: 495	
	JUnitTestCase.getEntityManagerFactory(String, Map) line: 406	
	JUnitTestCase.getEntityManagerFactory(String) line: 386	
	MetamodelMetamodelTest(MetamodelTest).initialize(boolean) line: 84	
	MetamodelMetamodelTest(MetamodelTest).initialize() line: 65	
	MetamodelMetamodelTest(MetamodelTest).setUp(boolean) line: 54	
	MetamodelMetamodelTest(MetamodelTest).setUp() line: 49	
	MetamodelMetamodelTest.setUp() line: 303	


>fix
- store MappedSuperclass types (in a List) that are in the state where their java superClass is known but their metamodel superType is not yet processed (missing from managedTypes)
- defer superType processing until after the next step where all non-mappedSuperclasses are processed
Comment 1 Michael OBrien CLA 2010-08-09 16:46:04 EDT
>See design issue 42 - we need to add the case where the superType is a transient class (non-entity & non-mappedSuperclass)
- we leave it as null in this as well (since the superType must be an IdentifiableType - and therefore persistent)
http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_42:_20090709:_IdentifiableType.supertype_-_what_do_top-level_types_set_it_to
Comment 2 Peter Krogh CLA 2010-11-10 11:06:49 EST
Deferring to Future, as part of 2.2 bug scrub.
Comment 3 Peter Krogh CLA 2011-06-20 13:50:20 EDT
defferring for 2.3 bug scrub.
Comment 4 Tom Ware CLA 2012-05-29 10:18:03 EDT
Deferring
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:06:26 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink