• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate - mapping FK from one column to two different tables

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic