| Summary: | [Entity Gen] First time adding many-to-many association fails | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] Dali JPA Tools | Reporter: | Nan Li <nan.n.li> | ||||||
| Component: | JPA | Assignee: | Nan Li <nan.n.li> | ||||||
| Status: | RESOLVED INVALID | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | neil.hauge | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | 3.3 M2 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Nan Li
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. |