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

Bug 341251

Summary: DynamicHelper.addTypes() should throw exception if multiple types having the same Class name and pointing to the same table are added to a the same helper
Product: z_Archived Reporter: Rohit Banga <rohit.banga>
Component: EclipselinkAssignee: Project Inbox <eclipselink.foundation-inbox>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: michael.norman, rohit.banga
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: dynamic

Description Rohit Banga CLA 2011-03-29 11:54:58 EDT
Build Identifier: 20100617-1415

If we add two types having the same name using the following code:

dynClass1 = dynamicClassLoader.createDynamicClass("typename");
typeBuilder1 = new JPADynamicTypeBuilder(dynClass, null, "tablename");

dynClass2 = dynamicClassLoader.createDynamicClass("typename");
typeBuilder2 = new JPADynamicTypeBuilder(dynClass, null, "tablename");

dynamicHelper.addTypes(false, false, typeBuilder1.getType(), typeBuilder2.getType());



Then the addTypes() method does not throw an exception to report a conflict. However when we try to call executeQuery() later on we get a NullPointerException at that point on the following line:
at org.eclipse.persistence.internal.dynamic.ValuesAccessor.setAttributeValueInObject(ValuesAccessor.java:58)

Instead the addTypes() method should report a configuration problem to ease debugging.

Reproducible: Always

Steps to Reproduce:
1.Create two dynamic types having dynamic classes with the same name and pointing to the same table.
2. Add the two dynamic types to the same dynamicHelper.
3. The addTypes() method does not throw an exception.
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:09:37 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink