• 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

1-to-M mapping confusion

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have three tables I'm trying to map but am getting odd messages from Hibernate (3.x). Table saved_searches has a key field of search_id and tables search_fields and sort_fields has the same field (this is the foreign key back to the parent) They then each have search_field_id and sort_field_id fields which are identity in the each of the child tables to keep the records unique. The hbm.xml files are below. I want to map the search_fields and sort_fields tables as lists of a given search. My two problems is how to tell Hibernate that when it adds records to the child tables that the second field needs to be "identity" and that the two tables are joined on the parent's key field. I keep getting:


org.hibernate.MappingException: Repeated column in mapping for entity: us.tx.state.oag.FinancialCrimesInquiry.db.HbmUserSavedSearchSortFields column: search_id (should be mapped with insert="false" update="false")


 
Arnie Morein
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More testing is yielding odder results.



linked to:



Keeps complaining about duplicate fields. However, taking the <composite-id> or <id> entries out of the children is a violation of the XML Schema. This is insane! How can I link via many-to-one properly listing the fields to index on, if listing them in the class in question is a duplication, especially when one of them is identity?

 
I'm not sure if I approve of this interruption. But this tiny ad checks out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic