I have table A which contains column c, column c is a foreign key (FK) referring to Table B. I only need to operate on table A. In this case, do I have to specify the foreign key relationship (1-to-1, 1-to-many, etc) in the hibernate mapping xml file ??
Originally posted by Edvins Reisons:
I don't think that Hibernate would complain if you don't map this relationship. The database will enforce referential integrity, and Hibernate will just transmit to the application any exception messages from the database.
Thanks. Let me make sure I understand well --- So you mean I do not need to specify the relationship in hbm.xml file AND the POJO, is that right ? Actually I only have a FK referencing relation but there is not any cascade constraint between the two tables. So, is it OK for me to completely ignore the relationship when I create the hbm.xml config and POJO classes (2 POJO) ?