Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

1-to-M mapping confusion

Posts: 16
  • Mark post as helpful
  • send pies
  • 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
Posts: 16
  • Mark post as helpful
  • send pies
  • 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?

If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic