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

Bug 348145

Summary: The list of discriminator column not updated when table of entity changed
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 7   
Whiteboard:
Attachments:
Description Flags
proposed patch
none
proposed patch neil.hauge: iplog+

Description Nan Li CLA 2011-06-02 17:29:07 EDT
Build Identifier: I20110525-0800

1. Create an entity Foo
2. Create another entity Foo1 making it extend Foo
3. Select entity Foo and go to JPA Details
4. Change the table name that entity Foo maps and check the columns listed in the Name drop down under Inheritance -> Discriminator column

The list of discriminator columns should be updated automatically once the table an entity maps is changed. Currently, you have to change the focus area first, and then go back to that entity to get the columns of the newly specified table repopulated to the list. 



Reproducible: Always
Comment 1 Neil Hauge CLA 2011-07-01 16:24:58 EDT
Moving JPA specific bugs to new JPA component in bugzilla.
Comment 2 Nan Li CLA 2012-08-30 10:11:07 EDT
order column has the same issue. Reproduce steps:

1. Define a ManyToMany mapping
2. Change the join table of the mapping and check the list of columns in the Name drop down under Ordering -> Order column

The list of order columns should be updated automatically once the join table is changed, but it isn't. Switching focus area is required to get the list repopulated.

Note: The column for the OrderColumn depends on the mapping. For a OneToMany mapping it will be in the target object's table. For a ManyToMany mapping or a OneToMany using a JoinTable it will be in the join table. For an ElementCollection mapping it will be in the target table.
Comment 3 Nan Li CLA 2012-08-31 11:49:25 EDT
Created attachment 220603 [details]
proposed patch

This patch includes fixes for the repopulating issue of both discriminator column and order column combo box.
Comment 4 Nan Li CLA 2012-09-04 15:47:41 EDT
The proposed patch is based on the following commit:

8e884ee Fixed filtering of completion proposals after... Karen Butzke
Comment 5 Karen Butzke CLA 2012-09-20 10:36:40 EDT
Patch looks good, committed to master:
http://git.eclipse.org/c/dali/webtools.dali.git/commit/?id=0079c7c700e873a05fb547c9ee7ee63b4c777316
Comment 6 Karen Butzke CLA 2012-09-25 07:55:10 EDT
I have reopened this bug due to junit test failures. I reverted the commit with this commit:

http://git.eclipse.org/c/dali/webtools.dali.git/commit/?id=49b62e1aa96cbc360da111e0bfb04a13304fc42d
Comment 7 Karen Butzke CLA 2012-09-25 07:56:32 EDT
Check the .log file in the junit test workspace for the NPE that is causing the test failures
Comment 8 Nan Li CLA 2012-09-25 12:41:19 EDT
Created attachment 221481 [details]
proposed patch

The NPE was thrown because the owner of the orderable (GenericJavaOrderable and GenericOrmOrderable) is null for JPA 1.0 mappings. A null check is added to prevent the NPE from happening. The patch works the same as the previous one and is based on the following commit:

9977e7b Oxm file version validation Paul Fullbright
Comment 10 Jolene Moffitt CLA 2012-10-16 13:14:40 EDT
Verified in build I-3.5.0-20121003040013 that you can update the table names and columns for that new table are updated without having to change the focus and come back.  To view steps to verify this issue go to http://wiki.eclipse.org/Dali_3.3_M2_Release