• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to specify relationship in mapping file

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ghulam Rashid:
Dont use <code> because its difficult to read.



:roll:
 
Gaurav Chikara
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic