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

Bug 347836

Summary: Order column is disabled when setting all the attributes of it to default
Product: [WebTools] Dali JPA Tools Reporter: Nan Li <nan.n.li>
Component: JPAAssignee: Nan Li <nan.n.li>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: neil.hauge
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Nan Li CLA 2011-05-31 13:37:57 EDT
Build Identifier: I20110525-0800

1. Create an orderable mapping
2. Go to JPA Details -> Ordering
3. Select Order column and give any value to it
4. Reset everything to default

Results:
1. With Java, the OrderColumn annotation is removed from the source even though Order column option is still shown as selected in the UI.
2. With Orm, the order-column element is removed from the XML and the "None" option is selected.

"None" and "Order column" are different states so we should not set the order column option to none if all the attributes of the order column are set to default.

Reproducible: Always
Comment 1 Neil Hauge CLA 2011-07-01 16:25:38 EDT
Moving JPA specific bugs to new JPA component in bugzilla.
Comment 2 Neil Hauge CLA 2011-10-07 12:51:51 EDT
Targeting to Juno release.
Comment 3 Nan Li CLA 2012-05-15 10:26:04 EDT
One more finding for Java: after giving a value to Order column, selecting other ordering options and then select back to Order column, the previous given value is retained in the UI while the Java class only has @OrderColumn annotation.
Comment 4 Nan Li CLA 2013-05-08 18:16:43 EDT
1. Regarding this issue with Java, the annotation will be removed if it is "Unset". See

OrderColumnComposite2_0.ColumnCombo.setValue(String value) {
     getSubject().setSpecifiedName(value);
}

=> AbstractJavaNamedColumn.setSpecifiedName(String name) {
     ......
     this.removeColumnAnnotationIfUnset();
     ......
}

2. Regarding this issue with ORM, the element will be removed if it is "Unset". See

OrderColumnComposite2_0.ColumnCombo.setValue(String value) {
     getSubject().setSpecifiedName(value);
}

=> AbstractOrmNamedColumn.setSpecifiedName(String name) {
     ......
     this.removeXmlColumnIfUnset();
}

The root cause for the issue of ORM could be how EMF translator works. A element will be removed from the XML if its value is null. See bug 373540 comment 1.