• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Hibernate - Creating .hbm file for link table

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all.

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.

Thanks!
 
Leonard Bedner
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to figure out, by using this .hbm:

 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic