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.
Product Version = NetBeans IDE Dev (Build 201204200400) Operating System = Windows 7 version 6.1 running on x86 Java; VM; Vendor = 1.7.0_03 Runtime = Java HotSpot(TM) Client VM 22.1-b02 I got a couple of Incomplete Join Columns errors when trying to run code generated by the wizard. For example: Exception Description: The @JoinColumns on the annotated element [field riskItem] from the entity class [class jpa.issue.RiskItemHasRiskCategory] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referencedColumnName elements must be specified in each such @JoinColumn. To reproduce: 1) Run main method in attached project. Compare the classes: RiskItemHasRiskCategory with the attached working one. The working classes can be seen from: https://validationmgr.svn.sourceforge.net/svnroot/validationmgr (trunk rev 12)
Created attachment 118582 [details] Sample project
Created attachment 118583 [details] Correct class example
Reassigning for evaluation in javaee team.
can you provide some sample sql for evaluation?
thanks, found schema in attached project
found 211691 with attached project also.
If I got it right in case of composite primary key all columns should be referenced in foreign key first and in provided schema only one column is referenced in risk_item_has_risk_category.fk_risk_item_has_risk_category_risk_item1 in this case it may be either db issue, may be wrong fk is created and allowed by db or may be schema capture issue. Can you provide sql script used to create tables?
tried next: CREATE TABLE AWITHCOMPOSITE ( ID1 Integer, ID2 VARCHAR(10), NAME VARCHAR(20), PRIMARY KEY(ID1,ID2) ) CREATE TABLE AWITHFORKEYTOCOMPOSITE ( ID Integer, NAME VARCHAR(10), REFID1 Integer, REFID2 VARCHAR(10), PRIMARY KEY (ID), FOREIGN KEY (REFID1,REFID2) REFERENCES AWITHCOMPOSITE(ID1,ID2) ) capture schema, create entities and got correct @JoinColumns({ @JoinColumn(name = "REFID1", referencedColumnName = "ID1"), @JoinColumn(name = "REFID2", referencedColumnName = "ID2")}) it's unclear if there is any error on nb side so far, please provide more information.
Created attachment 118887 [details] MySQL Workbench file I'll generate and attach the script in a bit.
Created attachment 118888 [details] MySQL script
Attached required script.
according to script foreign key declaration isn't complete FOREIGN KEY (`risk_item_id` ) REFERENCES `validation_manager`.`risk_item` (`id` ) in this case ide just generate what it can see, at most ide can try to verify incomplete constraint at some step. in my opinion this issue isn't valid.
moreover this table contain just 3 columns and only one correspond to another in risk_item, there is no one to match fmea_id from risk_item
one more point, if I'll run an application with "create tables" mode with "corrected" joincolumns, I'll get risk_item_has_risk_category with 4 columns
I agree. I corrected the MySQL Workbench file and script. After that the files where correctly generated.