Community
Participate
Working Groups
Build Identifier: I-3.4.0-20111117042436 1. Bring up the entity gen wizard, select a couple of tables and go to the Table Associations page 2. Click New Association button to bring up the Create New Association page 3. Select 'Many to many association' radio button, configure the association tables properly, and click Finish You will see the configured many to many association is not shown up on the wizard page. Adding it again will make it shown up; however, the remove button will be remaining enabled if removing the added association at this point, which leads to NPE exception if trying to click the remove button again. Reproducible: Always
Created attachment 207248 [details] stack trace stack trace for the NPE thrown when trying to click the remove association button after the association is already removed.
Created attachment 214887 [details] proposed patch
Can you describe the changes made in the patch to fix the problem? Specifically, what was causing the issue, and how it was addressed in the code.
A piece of the code of ORMGenCustomizer.getAssociations(boolean validOnly) is if (mValidAssociations == null) { /*filter out the invalid associations*/ mValidAssociations = new ArrayList<Association>(mAssociations.size()); for (int i = 0, n = mAssociations.size(); i < n; ++i) { Association association = mAssociations.get(i); if (association.isValid()) { <--- mValidAssociations.add(association); } } } At the line where the arrow points, it tries to verify if the association is valid which is done against the list of tables selected in the first page of the entity gen wizard. If choosing any one of tables in the database other than the selected tables for entities, the isValid() would return false so the association would not be added to the association list; therefore, the association will not show up after TableAssociationsWizardPage.updateAssociationsListPanel() is invoked. The changes I made in the patch, specifically in the class Association, are checking if a association is valid against the list of tables in the database instead of the list of selected table for entities. The rest of the changes in the patch is more code practice thing.
Thanks. Patch committed to head.
This change was subsequently removed as this case involved tables not selected in the table selection screen. All generation is based off of tables selected in the table selection screen and no others.