This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 90920 - JavaPersistenceGenerator.java generating a NPE
Summary: JavaPersistenceGenerator.java generating a NPE
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-12 01:33 UTC by dominic
Modified: 2007-01-10 10:04 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dominic 2006-12-12 01:33:10 UTC
in
src/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/JavaPersistenceGenerator.java
line 392 you have :
                            CMPMappingModel.JoinTableColumnMapping joinColumnMap
= dbMappings.getJoinTableColumnMppings().get(role.getFieldName());

however this call is returning null for joinColumnMap and hence an NPE is raised
in the following code. Part of the reason is that in debug i can see that
role.getFieldName() is returning fieldName but with an indice of 1 like
"fiedName1". This is caused (i think) by the fact that :

1) in buildCMPSet() of DbSchemaEjbGenerator addJoinTable was called *before* the
call to makeBeansUnique. so addJoinTable innocently adds the old mapping by
calling
roleAHelper.getCMPMapping().getJoinTableColumnMppings().put(role{A,B}Cmr,
joinColMap{A,B})
2) makeBeansUnique adds indices to all the beans. But the mapping
(getJoinTableColumnMppings()) still contains the old names of the beans before
they were made unique. So obviously
dbMappings.getJoinTableColumnMppings().get(role.getFieldName()) returns null.

This should be fairly simple to fix for someone who is familiar with the code.
Comment 1 Andrei Badea 2006-12-12 14:34:18 UTC
Looks like a P3.
Comment 2 Andrei Badea 2007-01-10 10:04:12 UTC
Should be fixed now. Thanks for the report.

Checking in
src/org/netbeans/modules/j2ee/persistence/entitygenerator/DbSchemaEjbGenerator.java;
/cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/entitygenerator/DbSchemaEjbGenerator.java,v
 <--  DbSchemaEjbGenerator.java
new revision: 1.7; previous revision: 1.6
done
Checking in
src/org/netbeans/modules/j2ee/persistence/entitygenerator/EntityClass.java;
/cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/entitygenerator/EntityClass.java,v
 <--  EntityClass.java
new revision: 1.3; previous revision: 1.2
done
Checking in
src/org/netbeans/modules/j2ee/persistence/entitygenerator/EntityMember.java;
/cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/entitygenerator/EntityMember.java,v
 <--  EntityMember.java
new revision: 1.3; previous revision: 1.2
done