Hi, the first thing is that you have to decide whether this asso. is supposed to be uni / or bidirectional. I'll give you a example for bidirectional.
But why does the Price Table has the freign key? In my understanding it would make sense to have multiple cars having the same price and not one car with multiple prices.
Anyway:
Code:
public class Car{
....
private Set prices;
.... // getter a. setter
}
public class Price{
....
private Car car;
.... // getter a. setter
}
Code:
car.hbm.xml:
<set name="prices" inverse="true">
<key column="car_id"/>
<one-to-many class="Price"/>
</set>
price.hbm.xml
<many-to-one name="car" column="carId" class="Car" />
-- simon --