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 159175 - NullPointerException at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.addJoinTable
Summary: NullPointerException at org.netbeans.modules.j2ee.persistence.entitygenerator...
Status: RESOLVED INCOMPLETE
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Sergey Petrov
URL: http://statistics.netbeans.org/except...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-25 21:52 UTC by mark_r_wood
Modified: 2009-09-23 11:19 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 135671


Attachments
stacktrace (1.15 KB, text/plain)
2009-02-25 21:52 UTC, mark_r_wood
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mark_r_wood 2009-02-25 21:52:00 UTC
Build: NetBeans IDE 6.5 (Build 200811100001)
VM: Java HotSpot(TM) Client VM, 10.0-b22, Java(TM) SE Runtime Environment, 1.6.0_06-b02
OS: Windows XP, 5.1, x86

User Comments:
GUEST: I was trying to generate the entitty classes from a databse, using SQLServer 2000

mark_r_wood: Was adding a database entity bean by right clicking on the package.  It is a mysql database.
Below is the table create statement for table adding.
DROP TABLE IF EXISTS `eztravels`.`gift`;
CREATE TABLE  `eztravels`.`gift` (
  `clientNo` int(10) unsigned NOT NULL,
  `when` date NOT NULL,
  `what` varchar(200) NOT NULL,
  PRIMARY KEY (`clientNo`,`when`) USING BTREE,
  CONSTRAINT `FK_gift_client` FOREIGN KEY (`clientNo`) REFERENCES `client` (`clientNo`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Here is for client table.
DROP TABLE IF EXISTS `eztravels`.`client`;
CREATE TABLE  `eztravels`.`client` (
  `clientNo` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `FirstName` varchar(100) NOT NULL,
  `MiddleName` varchar(100) DEFAULT NULL,
  `LastName` varchar(100) NOT NULL,
  `phone1` varchar(20) DEFAULT '',
  `phone2` varchar(20) DEFAULT '',
  `phone3` varchar(20) DEFAULT '',
  `Address1` varchar(100) DEFAULT '',
  `Address2` varchar(100) DEFAULT '',
  `state` char(2) DEFAULT '',



Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.addJoinTable(DbSchemaEjbGenerator.java:251)
        at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.addAllTables(DbSchemaEjbGenerator.java:206)
        at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.buildCMPSet(DbSchemaEjbGenerator.java:478)
        at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.<init>(DbSchemaEjbGenerator.java:86)
        at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPHelper.buildBeans(RelatedCMPHelper.java:310)
        at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard.createBeans(RelatedCMPWizard.java:360)
Comment 1 mark_r_wood 2009-02-25 21:52:06 UTC
Created attachment 77383 [details]
stacktrace
Comment 2 Sergey Petrov 2009-09-23 10:58:53 UTC
tried a bit modified for derby
CREATE TABLE  client (
  "clientNo" int NOT NULL,
  "FirstName" varchar(100) NOT NULL,
  "MiddleName" varchar(100) DEFAULT NULL,
  "LastName" varchar(100) NOT NULL,
  "phone1" varchar(20) DEFAULT '',
  "phone2" varchar(20) DEFAULT '',
  "phone3" varchar(20) DEFAULT '',
  "Address1" varchar(100) DEFAULT '',
  "Address2" varchar(100) DEFAULT '',
  "state" char(2) DEFAULT '',
    PRIMARY KEY ("clientNo")
);

CREATE TABLE  gift (
  "clientNo" int NOT NULL,
  "when" date NOT NULL,
  "what" varchar(200) NOT NULL,
  PRIMARY KEY ("clientNo","when"),
  CONSTRAINT "FK_gift_client" FOREIGN KEY ("clientNo") REFERENCES client ("clientNo") ON DELETE CASCADE
);

all beans was generated succesfully, also theere is no reoprts for 6.8 dev builds yet.
Comment 3 Sergey Petrov 2009-09-23 11:19:41 UTC
can't reproduce in 6.7 with mysql with tables above (except difference in charset/engine).
is it always reproducible for some tables or random issue?