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.
Entity classes are not generated correctly for PostgreSQL's tables. The primary keys are handled incorrectly. For example, I tried to create a table CUSTOMER with the same structure as the example table in GlassFish and it generated CustomerPK embeddable with no fields, two default constructors and error in toString() method. This embedded class is used in the generated Customer class which is incorrect because the CUSTOMER table has one primary key column: CUSTOMER_ID. So, CustomerPK shouldn't be used at all and customerId field should be marked as @Id instead. The generated entity doesn't work - it is even non-compilable.
Seems that the generator gets confused when the name of the primary key field is in quotes, i.e. customer_id integer not null primary key works, but "customer_id" integer not null primary key does not.
Reassigning to db/dbschema for further evaluation. The problem seems to be caused by that UniqueElement#getColumns().length is 0 for primary keys returned by TableElement#getPrimaryKey() when the name of the primary key is in quotes, whereas for names without quotes it is correctly 1. This confuses the entity generator so that it generates a separate PK class. I tested with PostgreSQL 8.2.4 and 8.2-505 JDBC 3 driver.
Forgot to change the component, see above.
The PostgreSQL driver quotes quoted index columns when returning them from DatabaseMetaData.getIndexInfo(). E.g. it returns "CUSTOMER_ID" instead of CUSTOMER_ID.
Added some enhanced support for PostgreSQL, otherwise known as a hack. Also filed PostgreSQL bug 3480. Checking in src/org/netbeans/modules/dbschema/jdbcimpl/TableElementImpl.java; /cvs/db/model/src/org/netbeans/modules/dbschema/jdbcimpl/TableElementImpl.java,v <-- TableElementImpl.java new revision: 1.6; previous revision: 1.5 done
Marking as closed.