aspose file tools*
The moose likes Object Relational Mapping and the fly likes Adding associations to a join entity.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Adding associations to a join entity.." Watch "Adding associations to a join entity.." New topic
Author

Adding associations to a join entity..

Eric Nielsen
Ranch Hand

Joined: Dec 14, 2004
Posts: 194
I'm running into some errors when trying to hang supplementary associations off of a join entity.


Ie StudioCompetition is a join entity that replaces a direct M:M between Affiliation and Competition that provides a place to hang additional qualifies of the association.

I can't seem to figure out how to allow hook up the extra associations -- I get errors regarding the number of columns in the foreign key.

My current setup looks like:

which yields an error like:


Earlier I had the association on the StudioSessionPrice named "affiliation" of Type Affiliation... so it wasn't really bi-directional (more of a loop). Which fails with a similar error message -- different wording, but same general intent -- wrong number of columns.. That error made sense since I had the mapped by of something with a two column PK mapped by a single column/wrong type. So I switched to the code shown above.

Is there a way to back the supplementary association work? Or do I need to lose the compound primary key, add an artificial key to the join table and just treat it like a regular entity?
[ December 25, 2008: Message edited by: Eric Nielsen ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding associations to a join entity..
 
Similar Threads
Deleting from a One-To-Many
error while persisting many to many relationship object : Attempt to assign
unwanted cascade delete behaviour
Hibernate: Trouble with a bidirectional list
Orphan delete doesn't seem to be working properly