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

Bug 348283

Summary: Entity Gen Wizard: Should only provide the list of selected tables to Table 2 field
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, neil.hauge
Version: unspecifiedFlags: neil.hauge: review+
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed Patch
none
Proposed Patch neil.hauge: iplog+

Description Nan Li CLA 2011-06-03 17:02:35 EDT
Build Identifier: I20110525-0800

Go to Table Associations page, click New Association button to open
Association Tables page, and click Browse button of Table 2 field to open Table Selection page, you'll see all the tables of the selected schema are listed which is incorrect. Only these tables that are selected on the first page, Select Tables, of the wizard should be listed. If not, choosing a table not selected on the first page will result in NPE like below when trying to add join columns for the association.

java.lang.NullPointerException
	at org.eclipse.jpt.jpa.gen.internal.Association.getReferrerColumns(Association.java:194)
	at org.eclipse.jpt.jpa.ui.internal.wizards.gen.TableAssociationsWizardPage.updateForeignKeyColumnGenProperty(TableAssociationsWizardPage.java:550)
	at org.eclipse.jpt.jpa.ui.internal.wizards.gen.TableAssociationsWizardPage.launchNewAssociationsWizard(TableAssociationsWizardPage.java:530)
	at org.eclipse.jpt.jpa.ui.internal.wizards.gen.TableAssociationsWizardPage.access$0(TableAssociationsWizardPage.java:519)
	at org.eclipse.jpt.jpa.ui.internal.wizards.gen.TableAssociationsWizardPage$1.widgetSelected(TableAssociationsWizardPage.java:148)

Reproducible: Always
Comment 1 Neil Hauge CLA 2011-07-01 16:24:44 EDT
Moving JPA specific bugs to new JPA component in bugzilla.
Comment 2 Nan Li CLA 2011-09-29 13:10:45 EDT
Created attachment 204312 [details]
Proposed Patch

This proposed patch fixes three problems:

1. The problem described in this bug
2. The problem described in bug 348286
3. The problem that Next button is still enabled after removing table name from the table field(s)
Comment 3 Neil Hauge CLA 2011-10-26 17:09:05 EDT
Is there a reason why you are adding the text modify listeners inside widgetSelected(...)?  I'm thinking this would be bad.
Comment 4 Nan Li CLA 2011-10-26 17:28:27 EDT
(In reply to comment #3)
> Is there a reason why you are adding the text modify listeners inside
> widgetSelected(...)?  I'm thinking this would be bad.

I believe I added that to fix the 3rd problem described in comment #2. If you enter values to the fields and then remove them, the Next button will be still enabled which will leads to NPE later.
Comment 5 Nan Li CLA 2011-10-26 18:18:57 EDT
Created attachment 206039 [details]
Proposed Patch
Comment 6 Neil Hauge CLA 2011-10-28 17:08:08 EDT
Patch released to head.
Comment 7 Jolene Moffitt CLA 2011-11-03 11:55:49 EDT
Verified in Build I-3.4.0-2011102024120 

Verified when you select Table Selection for Table 2, only the selected tables appear in the dialog and no errors appear. See the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.1_M3