Created attachment 105802 [details]
patch against dbschema
when generating entity beans from database I noticed wrongly generated composited keys. I could track this issue down to the dbschama in which the indices are queried from the jdbc metadata. So far so good, but then rows marked as statistics are considered valid index data.
I had a similar problem when building a db visualisier.
Please see the attached patch. It just skips the statistics rows. A further going patch making use of the corresponing functions in jdbc might be good, but this fix should be valid in the current logic.
This is a small example:
CREATE TABLE Antwort_element (
id serial NOT NULL ,
text LVARCHAR(1024) ,
Fragebogen_element_id INT NOT NULL ,
zahl INT ,
Antwort_fragebogen_id INT NOT NULL ,
PRIMARY KEY (id))
This created on an informix 11.5/11.7 database produces an entity with a composite primary key. With the attached patch the primary key is correctly reproduced.
Thanks for the patch, was applied by core-main/rev/6f8d9ff8335f
Thanks Jirko for review and integration and especially thanks you Matthias for the patch! I added the issue to the NetFIX Pool.
Integrated into 'main-golden', will be available in build *201102160501* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Jiri Rechtacek <email@example.com>
Log: #195251: DBSchema interprets index statistics as real indices (creates wrong composited key in entity beans);
applied matthias42's patch