• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Use of set tag in Hibernate mapping file for foreign key

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have 2 tables Person and Employee.
In Person table person's name is primary key.
In Employee table, there is a composite key, which consists of person's name(foreign key) and employee id.

Mapping file for above scenarios are:
for class person:


for employee class:



But I am getting exception.What is the correct way to make foreign key aa part of composite key.
When set will be used???

Thanks in advance
 
nami shekar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have changed my mapping file to:



And i am getting the following exception. Caused by: org.xml.sax.SAXParseException: Attribute "type" must be declared for element type "key-many-to-one".

Please help!!!
Or if the mapping is wrong, let me know how to form a composite key in which one will be foreign key.
Thanks
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic