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

Bug 325793

Summary: Should not be able to drag and drop an Embeddable into the diagram
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: Diagram EditorAssignee: Stefan Dimov <stefan.dimov>
Status: RESOLVED FIXED QA Contact: Stefan Dimov <stefan.dimov>
Severity: normal    
Priority: P3 CC: alexander.silgidjian, kaloyan
Version: 0.5   
Target Milestone: 0.5 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
make patch to be compatible with the head
none
patch
none
patch
none
patch
none
patch none

Description Karen Butzke CLA 2010-09-20 16:03:42 EDT
Currently I can drag and drop an Embeddable into the JPA Diagram Edtior. On the forums Stefan information me this is a bug: 
1. Yes, it's a bug. The embeddable classes are not supposed to appear in the diagram, since they don't represent persistable entities.


I haven't tested it, but what about the use case where you decide to change an Entity to an Embeddable, should it be removed from the diagram at that point?
Comment 1 Stefan Dimov CLA 2010-09-21 06:31:55 EDT
> ...
> I haven't tested it, but what about the use case where you decide to change an
> Entity to an Embeddable, should it be removed from the diagram at that point?
> ...

Yes, it should.
Comment 2 Petya Sabeva CLA 2010-10-05 09:34:48 EDT
Created attachment 180238 [details]
patch
Comment 3 Stefan Dimov CLA 2010-10-07 11:32:23 EDT
*** Bug 322782 has been marked as a duplicate of this bug. ***
Comment 4 Stefan Dimov CLA 2010-10-07 11:36:13 EDT
Seems that the patch is incompatible with the latest in HEAD
Comment 5 Petya Sabeva CLA 2010-10-08 10:06:06 EDT
Created attachment 180487 [details]
make patch to be compatible with the head
Comment 6 Stefan Dimov CLA 2010-10-08 11:12:16 EDT
When you change the mapping of the entity it disappears from the diagram. But if after that you try to open the java source code of the same class it seems that it's still entity - not embeddable or whatever. And if you change the mapping of the entity while it's open in the java editor as in the diagram editor then the mapping of the entity really changes, but a pop-up dialog appears showing some conflict between the editors.
Comment 7 Stefan Dimov CLA 2010-10-08 11:13:45 EDT
When you change the mapping of the entity it disappears from the diagram. But if after that you try to open the java source code of the same class it seems that it's still entity - not embeddable or whatever. And if you change the mapping of the entity while it's open in the java editor as in the diagram editor then the mapping of the entity really changes, but a pop-up dialog appears showing some conflict between the editors.
Comment 8 Stefan Dimov CLA 2010-10-08 11:14:19 EDT
Sorry for the double comment - browser problems ...
Comment 9 Petya Sabeva CLA 2010-10-14 07:01:12 EDT
Created attachment 180870 [details]
patch
Comment 10 Petya Sabeva CLA 2010-10-15 07:32:33 EDT
Created attachment 180944 [details]
patch

If there is an a relation between two entities and the mapping of one of them is changed (to Embeddable, MappedSuperclass or just remove any class annotations), the pictogram element will be removed from the diagram with the relation element.
Comment 11 Stefan Dimov CLA 2010-10-18 04:52:36 EDT
Now the ex-entity (along with its relations) is being removed properly from the diagram but there seems to be another problem:

1. Create two entities in the diagram with one-to-one bidir relation between them.
2. Change the inverse entity mapping to 'embeddable'.
3. Change the new embeddable class mapping back to entity through java editor or JPA details view
4. Drag the ex-embeddable entity back into the diagram

Result: The entity appeares into the diagram, but the relation between the entities doesn't appear.
Comment 12 Petya Sabeva CLA 2010-10-21 08:04:04 EDT
Created attachment 181383 [details]
patch
Comment 13 Stefan Dimov CLA 2010-10-21 09:56:57 EDT
Created attachment 181393 [details]
patch

The patch works fine, but there was a littlw correction that had to be done, so I did it and I'm submitting another version of the patch
Comment 14 Stefan Dimov CLA 2010-10-21 09:59:04 EDT
patch submitted ...