This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

[Hibernate] Composite key one-to-many XML Error

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two tables (Customer and Address). A customer can have multiple addresses.
Both tables use composite keys.

I am getting this error... But I don't know how to fix it.

Here is the Customer.hbm.xml file...

Here is the Address.hbm.xml file...

Any suggestions are greatly appreciated. This is my first attempt at using any O/R mapping API and unfortunately I have to try it on composite key tables since that is all we have.

Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your set elemnt doen't match the DTD for hbm files. The parse error:

is the DTD for the set element. If you are not used to dealing with XML definitions like this, you might want to look at DTDs on W3. What this line is telling you is a "set" element can only have one child "key" element. So you can't do this:

If you have a composite foreign key I'd get middlegen to generate the mapping for you, since writing composite foreign keys can be error prone.
I just had the craziest dream. This tiny ad was in it.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic