aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to specify relationship in mapping file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to specify relationship in mapping file" Watch "How to specify relationship in mapping file" New topic
Author

How to specify relationship in mapping file

Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
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 ]

SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Ghulam Rashid
Ranch Hand

Joined: Jan 14, 2002
Posts: 278
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

Joined: May 16, 2005
Posts: 513

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


:roll:


If you are not laughing at yourself, then you just didn't get the joke.
Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
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

Joined: Jan 14, 2002
Posts: 278
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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to specify relationship in mapping file