Is it possible to have foreign key enforced without object-to-object mapping?
Assuming the following mappings are provided: <class name="A" table="a_table"> <id name="id"/> <many-to-one name="entityB" column="fk_B" not-null="false" unique="true"/> </class> <class name="B" table="b_table"> <id name="id"/> </class> Java class: public class A { private long id; private B entityB; // getters and setters skipped } Is it possible to change the Hibernate mapping so that foreign key is still enforced and created by Hibernate upon startup , but class A would look like as the following: public class A { private long id; private long idOfB; // getters and setters skipped } I