balag wrote:
HI,
I have two table. But there is no direct relationship between these tables.
But First table's primary column used in second table. Like parent and child.
so is there is anyway that i can define a relatioship in my mapping file eventhough there is no direct relationship.
thanks in advance
Balag
Hibernate does not rely on there being a real relationship in the database. If you want you can still define a relationship in hibernate.
However, without foreign key it is easily possible that your reference will point to a non-existent key, leading to an Exception on the hibernate side.
You can prevent an exception in this case and instead obtain a null reference if you specify <many-to-one ... not-found="ignore" />