Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325531 - Adding new attribute adds Basic annotation without import
Summary: Adding new attribute adds Basic annotation without import
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: Diagram Editor (show other bugs)
Version: 0.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 0.5 RC3   Edit
Assignee: Petya Sabeva CLA
QA Contact: Stefan Dimov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 338725
  Show dependency tree
 
Reported: 2010-09-16 17:42 EDT by Karen Butzke CLA
Modified: 2011-03-02 15:03 EST (History)
1 user (show)

See Also:


Attachments
adding import statement if not exists (1.13 KB, patch)
2010-10-05 10:31 EDT, Petya Sabeva CLA
stefan.dimov: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Butzke CLA 2010-09-16 17:42:46 EDT
I am testing with 0.5RC2.
In the JPA diagram editor I added a new attribute to an entity. The attribute was added along with the @Basic annotation, but no import was added so the class no longer compiles. I think adding the @Basic annotation is unnecessary since that will be the default mapping type.
Comment 1 Petya Sabeva CLA 2010-10-04 06:54:14 EDT
Hi Karen,

I cannot reproduce it. Actually when a new entity is created in the JPA Diagram Editor, the whole package org.persistence.* is imported. So the reason, that the class is not compiled after attribute is added, is not the import statement. Sometimes there is a problem with the compilation unit's validation itself. The compilation unit is fine, but while it is not saved, it is marked as non compilable and when you save the source code, everything is fine. So there isn't problem to remove the "@Basic" annotation, but it will not resolve the issue.
Comment 2 Stefan Dimov CLA 2010-10-04 09:23:31 EDT
I agree with Petya ...
Comment 3 Karen Butzke CLA 2010-10-04 14:29:47 EDT
Ok, I have narrowed down the use case. If you create the Entity not using the diagram and just import javax.persistence.Entity then add the entity to the diagram and add an attribute. In this case the import is not added. I can't make it happen if I create the entity in the diagram. I think this should be a valid use case so I have reopened the bug.
Comment 4 Karen Butzke CLA 2010-10-04 14:37:48 EDT
One option to fix this would be to not add the @Basic annotation at all. Since this is the default attribute mapping type in JPA it would be valid to not put an annotation when adding a new attribute.
Comment 5 Stefan Dimov CLA 2010-10-05 04:46:58 EDT
I agree with Karen. The import should be added or the @Basic annotation should not be added at all.
Comment 6 Petya Sabeva CLA 2010-10-05 10:31:10 EDT
Created attachment 180246 [details]
adding import statement if not exists
Comment 7 Stefan Dimov CLA 2010-10-07 11:25:17 EDT
The patch is committed