dekalaked,
What you have there are two tables defined as follows:
(MySQL Code used to demonstrate)
Code:
create table US_State (
abbreviation VARCHAR(2) NOT NULL PRIMARY KEY,
name VARCHAR(64) NOT NULL ) type=MyISAM;
create table Address (
street VARCHAR(128) NOT NULL,
city VARCHAR(32) NOT NULL,
zip VARCHAR(16) NOT NULL,
state_abbrev VARCHAR(2) NOT NULL ) type=MyISAM;
Given the following SQL snippet what you have is a many-to-one relationship between the Address tables state_abbrev and the US_State tables abbreviation field therefore you can map it in hibernate like so:
Code:
<class name="Address" table="Address">
<!-- map the other fields here -->
<many-to-one name="stateAbbrev" class="US_State" column="state_abbrev" not-null="true" />
</class>
Most (note: I said MOST) one-to-many mappings can also be thought of as many-to-one mappings.
I hope this clarifies things for you!
------------------------------------------------
Nathan