I am wondering how to write the model, hbm.xml for table
Company
-------
id(PK)
name
address
typeid(fk)
Type
----
id(PK)
type
class Company(){
int id;
String name;
String address;
Type type;
}
class Type(){
int id;
String type;
}
(with get/set methods)
How to write the hbm?
I am using the hibernate 3.x.
Can you have multiple companies of the same type?
Don’t you really want a many to one relationship?
How about something like this (adapted from the Hibernate docs from here):