This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes [Hibernate] Composite key one-to-many XML Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "[Hibernate] Composite key one-to-many XML Error" Watch "[Hibernate] Composite key one-to-many XML Error" New topic
Author

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

David Wilson
Greenhorn

Joined: May 07, 2004
Posts: 6
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.

Thanks,
David
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [Hibernate] Composite key one-to-many XML Error
 
Similar Threads
1-to-M mapping confusion
Please suggest on this Mapping
Hibernate - Force foreign key lookup on insert
hibernate mapping
Help with mapping set - Hibernate