Hey folks,
I'm relatively new to Hibernate and I must say, so far, it's been great!
I've been going through the tutorials and documentation trying to get my feet wet and have had relatively little problems, but one in-particular has been giving me some trouble.
Rest assured I've googled the shit out of this as well as a couple of search attempts on these forums (before I even created this account) but have yet to find an answer.
From a purely database perspective, I want two tables as follows:
Table A: -------------------------------------------- | id | unique_field | some_other_fields | . . . | --------------------------------------------
Table B: ----------------------------------------------- | foreign_id | some_tableB_specific_fields | . . . | -----------------------------------------------
It's pretty simple. All I need is for Table B's primary key to be a foreign key pointing to Table A's "unique_field". I know this is possible in non-ORM systems because I've done it before. One of the main reasons I'd like to start using hibernate as a main mode of database access is due it's convenience and simplicity, plus it slashes hours of tedious database development required to produce complex systems. I really do feel as though it's an incredible achievement for DB developers. It gets us back to the runtime code-object world instead of mucking around with DB stuff all the time.
I think I'm just missing something obvious here. I would be a bit worried if something as simple as a foreign-primary key was not able to be handled by such a robust ORM.
Is there any way (via annotations or mappings) to make this happen?
Thanks in advance for any advice/suggestions.
|