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.
EntitiesFromDBGenerator sometimes/usually doesn't work. This makes the JPA support in form module unusable. It seems that the generator have a problem with tables that have a foreign key. Try, for example, to generate entity class for CUSTOMER table in the sample database of GlassFish. The following exception is thrown: java.lang.NullPointerException at org.n.m.dbschema.jdbcimpl.TableElementImpl.initFKs (TableElementImpl.java:463) at org.n.m.dbschema.jdbcimpl.TableElementImpl.initKeys (TableElementImpl.java:395) at org.n.m.dbschema.jdbcimpl.SchemaElementImpl.initTables (SchemaElementImpl.java:419) at org.n.m.dbschema.jdbcimpl.SchemaElementImpl.initTables (SchemaElementImpl.java:289) at org.n.m.j2ee.persistence.api.entity.generator.EntitiesFromDBGenerator .getSchemaElement(EntitiesFromDBGenerator.java:173) at org.n.m.j2ee.persistence.api.entity.generator.EntitiesFromDBGenerator .getTableClosure(EntitiesFromDBGenerator.java:146) at org.n.m.j2ee.persistence.api.entity.generator.EntitiesFromDBGenerator .generate(EntitiesFromDBGenerator.java:121) ...
Should be fixed in trunk now. The problem was indeed related to tables with foreign keys, the NPE was thrown when trying to generate an entity for a table with a foreign key reference to another table that wasn't provided to the generator. Please note that the fix is in the db/model module. Checking in TableElementImpl.java; /cvs/db/model/src/org/netbeans/modules/dbschema/jdbcimpl/ TableElementImpl.java,v <-- TableElementImpl.java new revision: 1.5; previous revision: 1.4 done Checking in SchemaElementImpl.java; /cvs/db/model/src/org/netbeans/modules/dbschema/jdbcimpl/ SchemaElementImpl.java,v <-- SchemaElementImpl.java new revision: 1.7; previous revision: 1.6 done