Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate - mapping FK from one column to two different tables

 
Tinker Tailor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,

I'm pretty new to hibernate and i'm working on a module which consists of 3 tables namely Doc_fees_master , Test_fees_master and there is an itemised_bill table , and the relation is as follows

itemised_bill - ID , Fees_id , fees_type

doc_fees_master - ID , fees , Doctorname , specialization

test_fees_master - ID , testname , fees

Now the fees_id field in itemised_bill is the ID field of doc_fees_master , so it could be like Fees_id=1 can exist in both doc_fees_master and test_fees_master , or in any one of them .

i'm using hibernate and i tried to map many-to-one relation on fees_id(itemised_bill) to both doc and test tables , which doesn't work , because same column cannot be referenced to 2 different tables , please let me know the right mapping to be done in hibernate using XML file and not annotations.

Thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic