Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to specify relationship in mapping file

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I have the following mapping file in hibernate




where I am trying to specify relationship of quoteId with another quote_detail table but hibernate is throwing an exception saying that duplicate property name specified

Is there any way we can specify these kind of relationships in hibernate
Thanks in advance
:roll:
[ August 10, 2006: Message edited by: Gaurav Chikara ]
 
Ghulam Rashid
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could be please post your other mapping. I remembered I had this problem once, I may look into. Dont use <code> because its difficult to read.
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ghulam Rashid:
Dont use <code> because its difficult to read.


:roll:
 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was my other file


I am putting code because moderator asked me to do so as it retains the formatting
[ August 11, 2006: Message edited by: Gaurav Chikara ]
 
Ghulam Rashid
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I understood from your mapping.

QuoteHeaderBO(One)---------------(Many)QuoteDetailBO

If this is what you are trying to map then QuoteHeaderBO.hbm.xml should have collction mapping for holding multiple QuoteDetailBO that we can define using bag,set ... because you have define many-to-one on both xml but you have not define one-to-many (inside bag/set) in QuoteHeaderBO. That could be the reason hibernate might be confusing.

Your mapping for QuoteHeaderBO should look like this.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic