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.
Hallo, I am using NetBeans 4.1beta + AS bundle. Creating CMP EJB from existing databse is very difficult due to problems described below. Primary key is lost in generated dbschema. At first i think this is a JDBC driver issue, but then i discovered that this feature is working for older version of JDBC drivers only. When i use pg72jdbc2.jar or mysql-connector-java-3.0.16-ga-bin.jar, everything works but when i use later drivers like mysql-connector-java-3.1.7-bin.jar, mysql-connector-java-3.2.0-alpha-bin.jar, pg73jdbc2.jar, pg74.215.jdbc2.jar or postgresql-8.0-310.jdbc2.jar generated dbschema does not contain information about PKs. This is my test db: CREATE TABLE test (id int4, name varchar(16), primary key(id)); Schema files generated using pg72jdbc2.jar and pg73jdbc2.jar are in attechement. You can quickly check if this problem persists. When you check databse in explorer window in Runtime tab, you will see Index test_pkey with "Non-unique" property set to false (which is right). But when you generate schema for this table, you will see "Unique" property of test_pkey index set to false (which is wrong).
Created attachment 20805 [details] Generated schema using older driver - OK
Created attachment 20806 [details] Generated schema using newer driver - Bad, without PK
Can you please check whether the primary key is detected correctly when you browse the database using the database explorer in Runtime tab? Thanks.
Yes, it is detected correctly in explorer regardless of JDBC driver version. Here are screenshots where you can see how it looks with pg73jdbc2.jar in explorer and in dbschema (PK and UNIQUE flag are lost).
Created attachment 20828 [details] Runtime tab screenshot
Created attachment 20829 [details] Database schema screenshot
It should work now for all PostgreSQL drivers. It was caused by a change in the recent driver implementations - getIndexInfo() method now returns "f" value for NON_UNIQUE column. Unable to fix it for MySQL. In this case it is a driver bug. mysql-connector-java-3.0.16-ga-bin.jar returns "false" for getIndexInfo() NON_UNIQUE column, but mysql-connector-java-3.2.0-alpha-bin.jar returns "true".
this issue will be marked as verified because it's quite old