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

Bug 335447

Summary: UI is out of sync once switching from Temporal to Converted
Product: [WebTools] Dali JPA Tools Reporter: Nan Li <nan.n.li>
Component: JPAAssignee: Nan Li <nan.n.li>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jolene.moffitt, karenfbutzke, neil.hauge
Version: unspecifiedFlags: karenfbutzke: review+
Target Milestone: 3.3 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch
none
proposed patch
none
proposed patch neil.hauge: iplog+

Description Nan Li CLA 2011-01-26 09:38:23 EST
Build Identifier: I20101028-1441

Both radio buttons of Default and Converted are selected once switching from Temporal to Converted, and selecting back to Temporal leads to Default being selected. This only happens with ORM convert.

Reproducible: Always

Steps to Reproduce:
1. Select an convertible mapping in the mapping file editor
2. In JPA detail view, select Type -> Temporal and then select Converted
3. Select back to Temporal
Comment 1 Nan Li CLA 2011-05-03 16:32:24 EDT
The reason of this bug ends up the timing issue of multiple events. The solution could be changing the design of UI or the way to handle the concurrent events. And we need to handle the error state when multiple converters are set at the same time. Considering all these, the changes would be too big to be included in release 3.0. Bug 344179 may end up with the same concern.
Comment 2 Neil Hauge CLA 2011-05-03 16:46:53 EDT
Given that the use case isn't a particularly common one and due to Nan's last comment, this is being deferred to 3.1.
Comment 3 Neil Hauge CLA 2011-07-01 16:25:49 EDT
Moving JPA specific bugs to new JPA component in bugzilla.
Comment 4 Nan Li CLA 2012-05-10 14:34:51 EDT
Created attachment 215422 [details]
proposed patch

Th fix looks a little bit awkward and hacky, but seems the best solution at this point. Users may still get UI out of sync issue if they quickly switch back and forth between different converter options which I think it's very rare.
Comment 5 Neil Hauge CLA 2012-07-03 16:33:28 EDT
I assume we would be looking at a different fix for 3.1 than the proposed patch?  This appears to be a case were we may need a batch style operation to ensure an orderly update.
Comment 6 Neil Hauge CLA 2012-09-10 11:18:48 EDT
Karen - I assume this is a case where we need to apply "batch model change" technique to ensure orderly change in the model.  Can you confirm and help Nan with the application of this technique?
Comment 7 Karen Butzke CLA 2012-09-11 16:49:12 EDT
I actually think the proposed patch is reasonable. I don't think setting the converter from the JPA details view via a Job with synchronous updates (I think that's what you mean by "batch model change") would help, if anything it would cause the problem every time.

My only comments are to do the same thing for the places where we have a mapKeyConverter (Element Collection and Multi-Relationship mapping I think are the only places). Also you could change buildNullConverter() to lazily initialize a instance of OrmConverter instead of having to build a new instance of NullOrmConverter every time the converter is changed.
Comment 8 Nan Li CLA 2012-09-17 17:27:57 EDT
Created attachment 221178 [details]
proposed patch

- incorporated the previous comments
- cleaned the code of ORM enumerated converter and Eclipselink ORM convert
- handled the default value of different types of converters with similar way

PS: this patch also fixed bug 336005.
Comment 9 Nan Li CLA 2012-09-17 17:30:42 EDT
The patch is based on the following commit:

0ad90a3 dump stack trace when JPA project manager is started to aid in debugging Brian Vosburgh
Comment 10 Karen Butzke CLA 2012-09-18 09:56:53 EDT
Nan, things are looking pretty good, just a few suggestions:

1. If you could get rid of the buildNullConverter() methods and use the nullConverter attribute in all the places that call buildNullConverter().
2. You changed EclipseLinkConvertCombo, but this affects the Java UI as well where the Default(none) is a valid option
Comment 11 Nan Li CLA 2012-09-18 12:13:12 EDT
Created attachment 221206 [details]
proposed patch

- removed buildNullConverter() methods
- added the Default(none) option back

This patch is based on the following commit:

387e840 [338725] - @Basic should not be added to attributes Petya Sabeva
Comment 12 Karen Butzke CLA 2012-09-18 12:41:23 EDT
committed to master with commit:
http://git.eclipse.org/c/dali/webtools.dali.git/commit/?id=f01bfd98943d26f4cd785cfb8a9a24337980a649
Comment 13 Jolene Moffitt CLA 2012-11-16 13:22:32 EST
Verified in build I-3.5.0-20121113030454 that the UI updates correctly when you switch from Temporal to Converted to Temporal and all radio buttons within the Type section in JPA details tab.  To view steps to verify this issue go to http://wiki.eclipse.org/Dali_3.3_M2_Release