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 139804 - NullPointerException at org.netbeans.modules.j2ee.persistence.wizard.fromdb.JavaPersistenceGenerator$Generator$EntityClassGenerator.generateRelationship
Summary: NullPointerException at org.netbeans.modules.j2ee.persistence.wizard.fromdb.J...
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Dongmei Cao
URL: http://statistics.netbeans.org/except...
Keywords:
: 139805 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-12 23:18 UTC by javydreamercsw
Modified: 2008-12-08 15:46 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 2583


Attachments
stacktrace (1.75 KB, text/plain)
2008-07-12 23:19 UTC, javydreamercsw
Details
stacktrace (1.75 KB, text/plain)
2008-07-15 12:27 UTC, Jan Horvath
Details

Note You need to log in before you can comment on or make changes to this bug.
Description javydreamercsw 2008-07-12 23:18:58 UTC
Build: NetBeans IDE Dev (Build 200807040101)
VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b14
OS: Windows 2000, 5.0, x86

User Comments: 
Creating entities from DB
Comment 1 javydreamercsw 2008-07-12 23:19:09 UTC
Created attachment 64389 [details]
stacktrace
Comment 2 Jan Horvath 2008-07-15 12:27:01 UTC
Build: NetBeans IDE Dev (Build 080710)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-119, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_13-b05-237
OS: Mac OS X, 10.5.4, i386

User Comments: 
generating entity classes from database
Comment 3 Jan Horvath 2008-07-15 12:27:15 UTC
Created attachment 64548 [details]
stacktrace
Comment 4 Dongmei Cao 2008-07-15 18:45:00 UTC
Honza, can you provide me a reproducible case? What database did you use? I can not reproduce it with the sample, travel
and another consult database from Matt.
Comment 5 Dongmei Cao 2008-07-15 18:59:50 UTC
*** Issue 139805 has been marked as a duplicate of this issue. ***
Comment 6 Dongmei Cao 2008-08-12 23:43:11 UTC
Mark it as "WORKSFORME" since I can not reproduce it.
Comment 7 John Baker 2008-09-18 08:24:15 UTC
See exceptions report for steps to reproduce.  Should probably be a P2 since NPE occurred
Comment 8 John Baker 2008-09-18 08:25:54 UTC
this issue has 15 duplicates
Comment 9 John Baker 2008-09-18 08:28:30 UTC
apparently this bug was also in 6.1
Comment 10 John Baker 2008-09-18 08:33:01 UTC
more clear steps to reproduce:

1) Create new Web application with JavaServer Faces framework
2) Select project, right-click and choose Entity Classes from Database
3) Select jdbc/sample datasource then click the Add all button after classes generated
4) Click Next
5) Enter a package name,  src
6) Click Next
7) Click Finish

result is the NPE 
Comment 11 Dongmei Cao 2008-09-19 21:28:46 UTC
John, I can not reproduce with your step in both 6.1 and 6.5. You need to show me.
Comment 12 John Baker 2008-09-24 21:20:01 UTC
I tried to reproduce on my Mac but could not this time (using the same build and scenario)

Seems to be a threading problem
Comment 13 Dongmei Cao 2008-09-26 21:02:18 UTC
When I was debugging another bug, I found a reproducible case for this one using the travel database:
- Generate Entity Classes from Database for table person only in package "person"
- Generate Entity Classes from Database again for the rest of the tables in a different package "travel" (note: the bug
happens only if a different package is used). NPE happens when click Finish.

It is not a threading issue. It is truely a bug in the code. The current code assumes that all the entity classes are in
the same package. When trying to generate relationship in the second step, it could not find "travel.Person".

The workaround is to generate all the entity classes in the same package. If you need some of the entity classes in a
different package, then do a refactoring afterwards.
Comment 14 Dongmei Cao 2008-09-27 00:15:40 UTC
Now that I have a reproducible case, this should be fixed in 6.5. The really bad part of this bug is after the NPE, it
leaves invalid (empty) entity classes behind.
Comment 15 Dongmei Cao 2008-09-29 18:52:43 UTC
Fixed in changeset f0ee0cf3c6b2
Comment 16 mvanek 2008-12-08 15:46:13 UTC
verified.
NetBeans IDE Dev (Build 200812080201)