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

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.

 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic