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 195251 - DBSchema interprets index statistics as real indices (creates wrong composited key in entity beans)
Summary: DBSchema interprets index statistics as real indices (creates wrong composite...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: DB schema (show other bugs)
Version: 7.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2011-02-09 20:23 UTC by matthias42
Modified: 2011-02-16 11:40 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch against dbschema (1.11 KB, patch)
2011-02-09 20:23 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description matthias42 2011-02-09 20:23:32 UTC
Created attachment 105802 [details]
patch against dbschema

Hey,

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.
Comment 1 Jiri Rechtacek 2011-02-15 07:19:57 UTC
Thanks for the patch, was applied by core-main/rev/6f8d9ff8335f
Comment 2 Jiri Kovalsky 2011-02-15 09:13:38 UTC
Thanks Jirko for review and integration and especially thanks you Matthias for the patch! I added the issue to the NetFIX Pool.

http://wiki.netbeans.org/NetFIXIssues
Comment 3 Quality Engineering 2011-02-16 11:40:09 UTC
Integrated into 'main-golden', will be available in build *201102160501* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6f8d9ff8335f
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #195251: DBSchema interprets index statistics as real indices (creates wrong composited key in entity beans);
applied matthias42's patch