This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 309856 - MappedSuperclasses from XML are not being initialized properly
Summary: MappedSuperclasses from XML are not being initialized properly
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-20 15:23 EDT by Jaro Kuruc CLA
Modified: 2022-06-09 10:30 EDT (History)
2 users (show)

See Also:


Attachments
Eclipse project demonstrating the problem (4.10 KB, application/x-zip-compressed)
2010-04-20 15:23 EDT, Jaro Kuruc CLA
no flags Details
Proposed changes (3.99 KB, patch)
2010-04-21 10:33 EDT, Guy Pelletier CLA
no flags Details | Diff
Update patch (940 bytes, patch)
2010-04-22 09:29 EDT, Guy Pelletier CLA
no flags Details | Diff
Proposed changes (197.56 KB, patch)
2010-04-27 15:29 EDT, Guy Pelletier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaro Kuruc CLA 2010-04-20 15:23:11 EDT
Created attachment 165485 [details]
Eclipse project demonstrating the problem

Annotation Processor is throwing NullPointerException during generation of metamodel when using orm.xml mappings only (no annotations).

Please see this thread for details: http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg04480.html
Comment 1 Guy Pelletier CLA 2010-04-21 10:33:05 EDT
Created attachment 165582 [details]
Proposed changes
Comment 2 Guy Pelletier CLA 2010-04-21 11:05:12 EDT
Changes have been submitted to the 2.1 stream (fix will be available from the nightly builds, http://www.eclipse.org/eclipselink/downloads/nightly.php)

Reviewed: Michael O'Brien

Tests: N/A, canonical model generation. Manually tested through Eclipse IDE. Existing JPA test (including extended tests) continue to pass.
Comment 3 Jaro Kuruc CLA 2010-04-22 04:48:28 EDT
After switching to version 2.1.0.v20100422-r7035, I get this error:

java.lang.RuntimeException: Exception [EclipseLink-7300] (Eclipse Persistence Services - 2.1.0.v20100422-r7035): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Conflicting XML elements [<id>] with the same name [id] were found. The first was found in the mapping file [META-INF/orm.xml] and the second in the mapping file [META-INF/orm.xml]. Named XML elements must be unique across the persistence unit.
	at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:366)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:121)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159)
	at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:134)
	at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:809)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:428)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:364)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:178)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:301)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:60)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:254)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:173)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: Exception [EclipseLink-7300] (Eclipse Persistence Services - 2.1.0.v20100422-r7035): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Conflicting XML elements [<id>] with the same name [id] were found. The first was found in the mapping file [META-INF/orm.xml] and the second in the mapping file [META-INF/orm.xml]. Named XML elements must be unique across the persistence unit.
	at org.eclipse.persistence.exceptions.ValidationException.conflictingNamedXMLElements(ValidationException.java:2142)
	at org.eclipse.persistence.internal.jpa.metadata.ORMetadata.shouldOverride(ORMetadata.java:595)
	at org.eclipse.persistence.internal.jpa.metadata.ORMetadata.mergeORObjectLists(ORMetadata.java:378)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.XMLAttributes.merge(XMLAttributes.java:252)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.merge(ClassAccessor.java:876)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor.merge(MappedSuperclassAccessor.java:504)
	at org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings.initPersistenceUnitClasses(XMLEntityMappings.java:425)
	at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnit.initXMLEntityMappings(PersistenceUnit.java:392)
	at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnit.<init>(PersistenceUnit.java:85)
	at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.initPersistenceUnits(PersistenceUnitReader.java:168)
	at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.<init>(PersistenceUnitReader.java:63)
	at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:329)
	... 24 more
Comment 4 Guy Pelletier CLA 2010-04-22 09:29:41 EDT
Created attachment 165756 [details]
Update patch

Sorry, just realized that I had forgotten to uncomment the mapped superclass from the orm.xml when I tested with my changes.

Anyway, attached is an update to the correction and has been submitted.

Reviewed: Michael O'Brien
Comment 5 Guy Pelletier CLA 2010-04-22 14:50:39 EDT
Reverted changes from last patch. More complete solution to follow ...
Comment 6 Guy Pelletier CLA 2010-04-27 15:29:43 EDT
Created attachment 166244 [details]
Proposed changes
Comment 7 Guy Pelletier CLA 2010-04-28 08:49:03 EDT
Changes have been submitted

Reviewed: Tom Ware

Tests: N/A, canonical model generation. Manually tested through Eclipse IDE. Existing JPA test (including extended tests) continue to pass.
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:30:19 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink