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

Bug 345923

Summary: targetEntity property affects correct resolving of a relation
Product: [WebTools] Dali JPA Tools Reporter: Stefan Dimov <stefan.dimov>
Component: Diagram EditorAssignee: Stefan Dimov <stefan.dimov>
Status: RESOLVED FIXED QA Contact: Stefan Dimov <stefan.dimov>
Severity: normal    
Priority: P3 CC: david_williams, neil.hauge, petya.sabeva
Version: 3.0Flags: david_williams: pmc_approved+
stefan.dimov: pmc_approved? (raghunathan.srinivasan)
stefan.dimov: pmc_approved? (naci.dai)
stefan.dimov: pmc_approved? (deboer)
stefan.dimov: pmc_approved? (neil.hauge)
stefan.dimov: pmc_approved? (kaloyan)
stefan.dimov: pmc_approved? (cbridgha)
petya.sabeva: review+
stefan.dimov: review+
neil.hauge: review+
Target Milestone: 3.0 RC2   
Hardware: All   
OS: All   
Whiteboard: PMC_approved
Attachments:
Description Flags
patch none

Description Stefan Dimov CLA 2011-05-16 07:48:55 EDT
Editor is unable to resolve relationships with targetEntity property of the mapping attribute:

1. Create two entities
2. Create one-to-one relation between them
3. Add targetEntity property to the mapping attribute of the owner entity
4. Remove and readd one of the entities to the diagram

Result: The relationship is not visualized.

If you remove the targetEntity property and repeat step #4 the relation will reappear
Comment 1 Stefan Dimov CLA 2011-05-16 11:28:34 EDT
Created attachment 195743 [details]
patch
Comment 2 Stefan Dimov CLA 2011-05-17 06:04:50 EDT
This defect doesn't represent correctly the diagram. If the user uses the targetEntity propert she won't be able to see the relations in the diagram. That's why I believe that this patch should get into RC2.

The only workaround I can think of is to remove the targetEntity property in order to see the relation, which is not much of a workaround, so it shouldn't be considered seriously.

The fix was tested manually. All the existing JUnit tests are passing successfully.

This bug is because in the editor code is used incorrectly the method RelationshipMappingAnnotation.getTargetEntity() instead of RelationshipMappingAnnotation.getFullyQualifiedTargetEntityClassName() and later on a certain string comparison returns false. Petya reviewed the fix.

The change is very small - in one place just the correct method is invoked, so the risk is very low.
Comment 3 Stefan Dimov CLA 2011-05-18 04:25:58 EDT
patch committed and released
Comment 4 Stefan Dimov CLA 2011-05-18 04:26:15 EDT
.