I am having trouble creating a one-to-many relationship between two existing classes that each have their own DB tables with their own primary keys. If I was not using Hibernate, I would simply creating another, associating table with 2 columns, 'aId' and 'bId' for classes A and B. However, everything I have tried based upon the existing sample files and the Hibernate manual have failed me, with various errors to complicated to explain with any brevity.
I don't just want to work around having an associating table, because I want to associate class A and class B with more than just one such table (class A has multiple one-to-many relationships with objects of type B, so I'd like to create multiple associations, each with its own table).
How can I create a table that does nothing more than associate two foreign keys? I can think of multiple kludge workarounds, but this is the way I would like to do it.
Thanks,
Jason Fisher
P.S. I'm somewhat of a newbie to Hibernate, and I'm jumping midstream into a project that has been using it already. I have lots of experience doing JDBC and SQL (and thus can see the potential time-saving value of Hibernate), but some of Hibernate (and the documentation) are over my head, do to lack of extreme database expertise. So, please, feel free to dumb down your answer :)
|