Community
Participate
Working Groups
Build Identifier: 20100917-0705 When entities have same name but no name attribute explicitly is specified for them, the duplicate name problem should be reported since the entity name defaults to the unqualified name (short name) of the entity class and entity names are scoped within the persistence unit and must be unique within persistence unit. Reproducible: Always Steps to Reproduce: 1. Create a java class named like Address and save it to a package like package1 2. Make the create java class an entity with the @Entity annotation or the <entity> XML element, but without specifying the name attribute 3. Create another java class giving the same name Address to it, but save it to another package like package2 4. Make the second java class an entity with the @Entity annotation or the <entity> XML element, but without specifying name attribute 5. Create a persistence unit and add both entities to it
Created attachment 186223 [details] Patch
Created attachment 186225 [details] Patch
Comment on attachment 186225 [details] Patch New patch. Removed the unused method "xmlClasslNames(MappingFileRef mappingFileRef)"
Created attachment 187218 [details] Patch -Split the big methods to multiple ones and entered them in different java classes -Fixed the text range and some other issues found during refactoring the code
Created attachment 187364 [details] Patch -Added extra APIs to org.eclipse.jpt.core.context.persistence.PersistenceUnit interface, e.g. getJavaEntities, getOrmEntities, etc. -Added validation of duplicate mapped classes cross the persistence unit regardless of the mapping types, e.g. define test1.Foo as an entity twice or as both entity and mapped superclass -Added validation of duplicate entity names as described in this bug. This validation only applies to entity mapping type. The validation takes effect when duplicates exist among java entities, among orm entities, or/and between java entities and orm entities In both validation cases above, overriding situation was considered. Both validations don't apply to java mapped classes which are overridden by the orm mapped classes.
Patch committed to head.