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 172075

Summary: generated PK files extremely unfriendly
Product: javaee Reporter: err <err>
Component: PersistenceAssignee: Sergey Petrov <sj-nb>
Status: RESOLVED WONTFIX    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: ER diagram of part of schema

Description err 2009-09-12 02:40:53 UTC
Attached ER diagram. The table chart_has_event is an n:m mapping. Notice that most every table here has a foreign key to
chart_has_event. "entity class from databse" generates a different PK for each of these classes. That is decidedly not
useful. All the classes should use the same class to represent the primary key; then things like "equals" work and the
same PK class works to query multiple tables.

/db/ $ ls *PK*
AspectIdPK.java  ChartHasEventPK.java  PlanetIdPK.java  ProfilesPK.java
AspectsPK.java   EventOrderPK.java     ProfilePK.java
/db/ $ diff ChartHasEventPK.java EventOrderPK.java
30c30
< public class ChartHasEventPK implements Serializable {
---
> public class EventOrderPK implements Serializable {
38c38
<     public ChartHasEventPK() {
---
>     public EventOrderPK() {
41c41
<     public ChartHasEventPK(int chartId, int eventId) {
---
>     public EventOrderPK(int chartId, int eventId) {
72c72
<         if (!(object instanceof ChartHasEventPK)) {
---
>         if (!(object instanceof EventOrderPK)) {
75c75
<         ChartHasEventPK other = (ChartHasEventPK)object;
---
>         EventOrderPK other = (EventOrderPK)object;
87c87
<         return "org.metawb.astro.db.ChartHasEventPK[chartId=" + chartId +
---
>         return "org.metawb.astro.db.EventOrderPK[chartId=" + chartId +
Comment 1 err 2009-09-12 02:42:14 UTC
Created attachment 87532 [details]
ER diagram of part of schema
Comment 2 Sergey Petrov 2009-09-14 09:57:32 UTC
may be some analysis can be added to track such cases, but it looks more like enhancement for me.
Comment 3 Martin Balin 2016-07-07 08:54:49 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss