So, I am currently attempting to create a .hbm file for a link table, and running into some issues. First off, some details:
I have 1 table called Ability and another table called CastMember. These tables have a many-to-many relationship (cast members can have many abilities and vice versa), so I created a link table, called Ability_CastMember. Here are the table details:
Now, I currently have a mapping file for the Ability table which allows me to get a Set containing all CastMembers, and was going to do the inverse in my CastMember mapping file. At any rate, here is Ability.hbm.xml:
This of course works as expected. So at this point, I was thinking that I didn't even need to have a entity/mapping for the link table! Now here is the issue... All of the data for these tables is static, and thus I keep it in xml files. I use Castor to unmarshall the XML into the entities, and then use hibernate to persist them. So, turns out I need a Ability_CastMember entity and mapping file, if only to be able to load the data with my current system. It won't be used for anything else (that I can think of at the moment). I have googled everything known to man, and have gone through the various docs on the Hibernate main site, but I am still not able to find what I need to create it.
Any help would be greatly appreciated.
Joined: Oct 04, 2009
I was able to figure out, by using this .hbm:
subject: Hibernate - Creating .hbm file for link table