Can I bypass an intermediate object in hibernate

Posted by Jherico on Stack Overflow See other posts from Stack Overflow or by Jherico
Published on 2010-05-07T22:08:30Z Indexed on 2010/05/07 22:38 UTC
Read the original article Hit count: 164

Filed under:
|

I have top level entities TRACK, MEDIA_GROUP and MEDIA, each with an integer primary key. I also have a join table from TRACK to MEDIA_GROUP which is 1:1 and MEDIA has a FK column into MEDIA_GROUP. I'm trying to find a way in hibernate to map a collection of Media directly into the Track object, bypassing the creation of a MediaGroup object.

Basically I want to turn this:

TRACK <-> MEDIA_TRACK_MAP <-> MEDIA_GROUP <-> MEDIA

into this:

TRACK <-> MEDIA_TRACK_MAP <-> MEDIA

But the join column between MEDIA_TRACK_MAP and MEDIA isn't the primary key of MEDIA.

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate