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 100309 - JPA mapping generate duplicate relationship fields
Summary: JPA mapping generate duplicate relationship fields
Status: RESOLVED INVALID
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks: 99509
  Show dependency tree
 
Reported: 2007-04-08 07:44 UTC by Nam Nguyen
Modified: 2008-11-30 23:37 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
entity beans generation log (40.78 KB, text/plain)
2007-04-10 18:35 UTC, Nam Nguyen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nam Nguyen 2007-04-08 07:44:38 UTC
- Use wizard 'New Entity Classes from Database', select java db sample database
- Generate JPA classes by select all tables
- Note that all relationship fields have duplicate such as 'productCode' and
'productCode1'.
- Deploying application will cause validation error like:

Exception [TOPLINK-48] (Oracle TopLink Essentials - 2.0 (Build b41-beta2
(03/30/2007))): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: Multiple writable mappings exist for the field
[PRODUCT.PRODUCT_CODE].  Only one may be defined as writable, all others must be
specified read-only.
Mapping: oracle.toplink.essentials.mappings.OneToOneMapping[productCode1]
Comment 1 Nam Nguyen 2007-04-08 07:47:25 UTC
Note that I am using almost current code.
Comment 2 Erno Mononen 2007-04-10 10:59:34 UTC
Could please specify the OS you're using and the exact build version? I wasn't 
able to reproduce this with M8 on Linux nor with the latest daily build 
(200709041800), but with the latter there are other problems (issue 100213). 
Are there any exceptions in the log file? 
Comment 3 Nam Nguyen 2007-04-10 18:32:18 UTC
I am on WinXP, using JDK 1.6.
Note that I checked out java cvs module using tag release60-m8 to get around
issue 99900.
(remove keyword after providing details, please add back if more details needed)
Comment 4 Nam Nguyen 2007-04-10 18:35:49 UTC
Created attachment 40697 [details]
entity beans generation log
Comment 5 Nam Nguyen 2007-04-16 20:10:05 UTC
Still be able to reproduce this with latest code.  So this seems to be
independent of issue 100213.
Comment 6 Nam Nguyen 2007-04-18 17:10:31 UTC
I don't know how my javadb sample database get *all* foreign key constraints
duplicated.  Anyway, dropping the duplicate constraints solve the duplicate
relationship fields problem.  As nobody else experience the weird symptom as I
did, I just close this issue as INVALID.
Comment 7 ododos 2008-11-30 23:37:15 UTC
I had the same problem and I found out that somehow I had duplicate foreign keys created (possibly by having the Table
Generation Strategy of my Persistence Unit set to Create at some point) and the wizard generated duplicate fields on my
entity bean. I fixed the duplicate foreign keys in my database, recaptured the database schema from Netbeans and
everything was OK from then on.