Assuming the following mappings are provided:
As said
I understand that if I convert
but foreign key would not be enforced by the database.
So my advice is: use both
public class EntityA {
private Integer idOfB;
private EntityB entityB;
// getter's and setter's
}
And
Notice when two properties share the same column, you have to put settings about it in just one property. Otherwise, Hibernate will complain some errors. It explains why i define update="false" and insert="false" in entityB property.
regards,