• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

1-to-M mapping confusion

 
Arnie Morein
Greenhorn
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
Greenhorn
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?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic