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 80307 - IOException while generating entity class
Summary: IOException while generating entity class
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: DB schema (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-14 14:18 UTC by Daniel Prusa
Modified: 2008-08-08 04:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Prusa 2006-07-14 14:18:57 UTC
Use database schema attached in issue 76916, generate entity class for Table713
-> IOException is thrown
Comment 1 Daniel Prusa 2006-07-14 14:21:15 UTC
IOE is caused by NPE, null is passed in list of Fields to createConstructor method
Comment 2 Rochelle Raccah 2006-07-18 01:31:33 UTC
The problem is that Table713 has no primary key in the dbschema (the index has a
unique true, but not primary true).  This table should be grayed out in the
available tables panel with the (no primary key) note.
Comment 3 Rochelle Raccah 2006-07-18 02:25:47 UTC
More info: When debugging in DbSchemaEjbGenerator, the pk is not null (so maybe
it really has one which is why it's not grayed out), *but* the test for
pk.getColumn(cols[col].getName()) != null for the column involved (ID) fails
because the column is named like this "newSchema.table713.ID" as it should be,
but the column in the pk is named like this "newSchema.table294.ID" which is
definitely wrong!

Where did you get this dbschema? Is it possible it was corrupted or modified by
hand?
Comment 4 Andrei Badea 2006-07-18 08:29:12 UTC
Jan Horvath generated a 1000 tables database using a script and generated the
schema from that database. I have asked, but it is quite unlikely that he
modified it by hand.
Comment 5 Rochelle Raccah 2006-07-18 20:43:39 UTC
Changing to db/dbschema - this is either a corrupt dbschema or a problem reading
it in.
Comment 6 David Vancouvering 2008-01-10 00:30:24 UTC
dprusa: Is this still an issue, or can we close it?  If it's still an issue, can someone please give me a reproduction?
 Thanks.
Comment 7 Daniel Prusa 2008-01-10 00:36:02 UTC
I think, this issue is no longer relevant for nb 6.x, we can close it.
Comment 8 Rochelle Raccah 2008-01-10 00:42:48 UTC
I think someone should try it before deciding it's not relevant.  There are very clear instructions and dbschema code
hasn't changed, so chances are the bug still exists.
Comment 9 David Vancouvering 2008-01-10 01:24:56 UTC
OK, thanks, I'll try it.
Comment 10 Andrei Badea 2008-08-07 16:24:37 UTC
Phew!

The schema file is indeed corrupted because of a bug in the XML serializer. The serializer uses the FQN and hash code of
an object in an attempt to generate an unique name for this object. This is obviously not enough, since two objects,
even of the same class, can have the same hash code.

In this case it seems the UniqueKeyElementImpl of table294 and that of table713 had the same identity hash code (the
hashCode() method for this class is not overridden). So the UKEI of table294 was serialized, but that of table713 wasn't
and the one of table294 was used instead.

21cdf8a16221
Comment 11 Quality Engineering 2008-08-08 04:31:05 UTC
Integrated into 'main-golden', available in build *200808080201* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/21cdf8a16221
User: Andrei Badea <abadea@netbeans.org>
Log: #80307: IOException while generating entity class