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 92031 - Entity Classes from DB: error when foreign key column name is the same as the referenced table name
Summary: Entity Classes from DB: error when foreign key column name is the same as the...
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-08 16:09 UTC by Andrei Badea
Modified: 2007-01-15 20:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace (1.86 KB, text/plain)
2007-01-08 16:12 UTC, Andrei Badea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2007-01-08 16:09:31 UTC
Invoke the Entity Classes from Database wizard for the following tables:

-----%<-----
create table part1 (id int not null primary key);
create table part2 (part1 int not null references part1(id) primary key);
-----%<-----

The attached exception is thrown.
Comment 1 Andrei Badea 2007-01-08 16:12:16 UTC
Created attachment 37149 [details]
Stack trace
Comment 2 Andrei Badea 2007-01-08 17:23:11 UTC
This is caused by the entity class model generating a part1 CMR field where
there already is a part1 CMP field. When the relationships are uniquified the
part1 CMR field is renamed to part2, but the CMR mapping is not touched. 

Simply renaming the CMR mapping as the respective CMR fields are renamed is not
possible, as seen in issue 83323.
Comment 3 Andrei Badea 2007-01-09 14:39:22 UTC
Fixed.

Checking in
src/org/netbeans/modules/j2ee/persistence/entitygenerator/DbSchemaEjbGenerator.java;
/cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/entitygenerator/DbSchemaEjbGenerator.java,v
 <--  DbSchemaEjbGenerator.java
new revision: 1.6; previous revision: 1.5
done
RCS file:
/cvs/j2ee/persistence/test/unit/src/org/netbeans/modules/j2ee/persistence/entitygenerator/DbSchemaEjbGeneratorTest.java,v
done
Checking in
test/unit/src/org/netbeans/modules/j2ee/persistence/entitygenerator/DbSchemaEjbGeneratorTest.java;
/cvs/j2ee/persistence/test/unit/src/org/netbeans/modules/j2ee/persistence/entitygenerator/DbSchemaEjbGeneratorTest.java,v
 <--  DbSchemaEjbGeneratorTest.java
initial revision: 1.1
done
RCS file:
/cvs/j2ee/persistence/test/unit/src/org/netbeans/modules/j2ee/persistence/entitygenerator/Issue92031.dbschema,v
done
Checking in
test/unit/src/org/netbeans/modules/j2ee/persistence/entitygenerator/Issue92031.dbschema;
/cvs/j2ee/persistence/test/unit/src/org/netbeans/modules/j2ee/persistence/entitygenerator/Issue92031.dbschema,v
 <--  Issue92031.dbschema
initial revision: 1.1
done
Comment 4 Petr Blaha 2007-01-11 17:21:44 UTC
The issue is candidate for backporting to NB 5.5.1.
Comment 5 pgebauer 2007-01-15 09:05:35 UTC
The issue has been fixed in release551.

Checking in DbSchemaEjbGenerator.java;
/cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/entitygenerator/DbSchemaEjbGenerator.java,v
 <--  DbSchemaEjbGenerator.java
new revision: 1.1.2.1.2.12.12.1; previous revision: 1.1.2.1.2.12
done
Comment 6 crued 2007-01-15 20:39:17 UTC
Is this related to issue 91743?

   http://www.netbeans.org/issues/show_bug.cgi?id=91743

I don't see the NullPointerException in the stack trace of the other issue that
is in the stack trace for this issue, but it seems like it could be related.