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.
- Invoke New Entity from Database wizard, connecting to sample javaDB database. - Select all tables for entity generation, make sure table CUSTOMER_PURCHASE_ORDER is included. - The wizard generates a separate entity class for the above association table. IMO, the right mapping should be: (1) Annotate @ManyToMany on both fields: Customer.purchaseOrderCollection and PurchaseOrder.customerCollection. (2) Annotate @JointTable(name="CUSTOMER_PURCHASE_ORDER") on either of the above fields, whichever is decided as owning entity. There should be no entity class for association tables.
I think this is high-profile feature and the fix should make it to M9.
Which sample database do you mean? There is no CUSTOMER_PURCHASE_ORDER table in the sample database registered by the Java DB module.
I am attaching my sample db. Maybe I did the change a month back. But I did clean build frequently and I recently reinstalled glassfish. So where is the dirty database coming from?
Created attachment 41141 [details] sample database
Reinstalling GlassFish never rewrites an existing sample database. The database is also stored outside the userdir, so you don't get a new one when you wipe your userdir.
Please attach the SQL script used to create the C_P_O table, or at least the zipped-up database directory. Why do you have four foreign keys in C_P_O? This makes the wizard think it's not a join table (which is expected to have two foreign keys).
Where should i look for the database dir? Please tell me the path.
It's in Tools - Options - Advanced Options - Server and External Tool Settings - Java DB Database - Database Location. Usually the path is $HOME/.netbeans-derby.
Created attachment 41179 [details] database
I drop the duplicate constraints and the code gen does produce correct m-n mapping. Sorry for false alarm.
BTW, I can't think of any use cases that justify additional constraints or duplicate constraints on the association table. But if you want to handle this corner, it is certainly of much less priority.