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 96530 - Cannot Created Intersection Classes
Summary: Cannot Created Intersection Classes
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-26 05:47 UTC by gamelol
Modified: 2016-07-07 08:52 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gamelol 2007-02-26 05:47:26 UTC
The feature affected is "Create Persistence Unit / Entity Classes from 
Database".

Album <-> AlbumPhotos <-> Photos

An Album has many Photos
A Photo can belong in many Albums

The IDE cannot automatically create a class for AlbumPhoto unless AlbumPhoto 
has at least 1 extra field beyond Album PK and Photo Pk.  Ie.

AlbumPhoto(albumPK,photoPK) -> no class generated
AlbumPhoto(albumPK,photoPK,dummy) -> class generated.
Comment 1 Andrei Badea 2007-02-26 10:04:09 UTC
This is by intention. The intersection (usually called join) table is used in a
relational database to store the relationship between an album and its photos,
and between a photo and the albums it is included in. However, in entity classes
that information is stored in the Album and Photos entity classes themselves,
there is no need for a class corresponding to the join table. There should be
methods Album.getPhotos() and Photos.getAlbum() returning collection of
instances of Photos and Albums, respectively.
Comment 2 gamelol 2007-03-03 03:30:48 UTC
It is not invalid.  The option whether to create an intersection class should 
be optional.  What if I extend my schema later to include a field on the 
intersection table?  I would have to modify a potential huge amount of code to 
accomodate the new intersection table to process the new intersection entity.

If I can choose to have an intersection class from the beginning, I'd only 
have to accomodate the fields, not an entirely new class.

Please add the option!

Thanks...

Comment 3 Andrei Badea 2007-03-20 18:10:41 UTC
Makes it an enhancement then. It also seems to me this kind of goes against the
spec. Any evidence proving that people prefer to generate classes for join
tables would be helpful.
Comment 4 Jiri Prox 2007-09-17 20:31:33 UTC
Obsolete milestone, please reevaluate
Comment 5 Martin Balin 2016-07-07 08:52: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